var has function scope, val will have block scope in JavaScript 6