Logo

Programming-Idioms

History of Idiom 13 > diff from v63 to v64

Edit summary for version 64 by fadamakis:
New JS implementation by user [fadamakis]

Version 63

2019-09-26, 17:58:43

Version 64

2019-09-26, 18:04:58

Idiom #13 Iterate over map keys and values

Print each key k with its value x from an associative array mymap

Illustration

Idiom #13 Iterate over map keys and values

Print each key k with its value x from an associative array mymap

Illustration
Extra Keywords
table dictionary hash traverse traversal
Extra Keywords
table dictionary hash traverse traversal
Code
for (const key in mymap) {
    console.log('key:', key, 'value:', mymap[key]);
}
Doc URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in