In the following code example writes
let
does for us is create a unique value ofi
each time the loop iterates. When our loop is over, we have created six separate values ofi
that are stored in memory that ourconsole.log(i)
statements can access."
How let
create a new i
in every iteration but only one var i
?