Logo

Programming-Idioms

History of Idiom 2 > diff from v76 to v77

Edit summary for version 77 by blakecallens:
[JS] replaced var with let

Version 76

2019-09-26, 16:49:08

Version 77

2019-09-26, 16:54:56

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Illustration

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Illustration
Code
for (var i = 0; i < 10; i++) {
  console.log("Hello");
}
Code
for (let i = 0; i < 10; i++) {
  console.log("Hello");
}
Comments bubble
let quarantines the scope of i to the loop in ES6