JS Loop - inline variable declaration

0 votes
214 views
added Jul 7, 2018 in Javascript by LC Marshal Captain (25,790 points)
edited Jul 12, 2018 by LC Marshal
for (let i = 0; i < 3; i++) {
  alert(i); // 0, 1, 2
}
alert(i); // error, no such variable
lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...