for - of

Added in ES 2015.
This is for looping over objects.
Iterators exist on maps, arrays and sets.

Iterating a Map

This returns an array of [key,value] for each iteration.

const myMap = new Map() 
myMap.set('prop1', 'value1')
myMap.set('prop2', 'value2')

for (const item of myMap) {

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext