Javascript Scoping

If you understand what’s going on when this runs, then you understand javascript scoping.

var x = 5;
alert(x);

function foo(){alert(x);var x = 10;alert(x);}

foo();
alert(x);


Posted

in

by