用for循环解释‘let’和块范围
let
let x;let x; // error!
let
let i = 100;setTimeout(function () { console.log(i) }, i); // '100' after 100 ms
let
for
// prints '10' 10 timesfor (var i = 0; i < 10; i++) { process.nextTick(_ => console.log(i)) } // prints '0' through '9'for (let i = 0; i < 10; i++) { process.nextTick(_ => console.log(i)) }
let
for
let
let
var
let
for
慕斯709654
陪伴而非守候
相关分类