by nhenezi · 12y ago · 0 comments
Javascript doesn't have block scope; above example is equivalent to:
(function() {
var x, y;
x = 1;
console.log( x );
if ( x ) {
y = 2;
}
console.log( y );
})()
Variable declarations are always hoisted to the top of containing scope.No comments yet.