DEV Community

Discussion on: For In and For Of in Javascript

Collapse
 
ziratsu profile image
Ustariz Enzo

Sigh, how I love that Stack overflow tone :).

1) There is no problem using const inside for..in or for..of loops.
On the contrary it adds a level of security if you don't want to reassign the value of the variables inside of the loop.
Do you have some sources of "you're telling the scripting engine not to release the variables when done.", I'll be happy to read it.

2) Indeed I know destructuring and that funky syntax, but you need to use a for...of loop with the Array returned by Object.entries, else you won't have what you are trying to accomplish.