Built-in keys iterator in JavaScript
All iterables have the built-in keys
iterator that allows you to iterate over
keys. Let's test it on an array:
javascriptlet arr = ['a', 'b', 'c'];
We get an iterator:
javascriptlet iter = arr.keys();
And loop through it:
javascriptfor (let elem of iter) {
console.log(elem); // 0, 1, 2
}
Задание 1
Test the work of this iterator
on a Map collection.
Задание 2
Test the work of this iterator
on a Set collection.