JavaScript scope and LET instruction

by Mohan 2012-09-20 23:39:02


JavaScript scope and LET instruction
JavaScript 1.7
var x = 5;
var y = 0;
let (x = x+10, y = 12) {
Print(x+y);
}
Print(x+y);
prints:
27
5
or,
for ( let i=0 ; i < 10 ; i++ ) {
Print(i + ' ');
}
Print(i);
prints:
0 1 2 3 4 5 6 7 8 9 test.js:4: ReferenceError: i is not defined


903
like
0
dislike
0
mail
flag

You must LOGIN to add comments