What is the difference in doing the following three constructions in JavaScript:
let dd = [ 1, 2, 3, 4, 5 ];
for(const item of dd) console.log(item);
for(let item of dd) console.log(item);
for( item of dd) console.log(item);
It seems they all produce the exact same results so wondering if there are some subtle differences between them, especially when neither let
nor const
is there, specifically in the context for a for
–of
loop.