how to iterate through dictionary js code example
Example 1: javascript for loop over dictionary
var dict = {'a': 1, 'b': 2, 'c' : 3};
for([key, val] of Object.entries(dic)) {
console.log(key, val);
}
Example 2: javascript loop over dictionary
'use strict';
const object = {'a': 1, 'b': 2, 'c' : 3};
for (const [key, value] of Object.entries(object)) {
console.log(key, value);
}