Next gripe about javascript.
The idiomatic way to create an array is
let something = [];
The idiomatic way to create an object is
let otherthing = {};
The idiomatic way to create a set
let myset = new Set();
The idiomatic way to create a map
let mymap = new Map();
AND
if you want to actually loop through the data in an object {}, you have to beware of prototype data that you never put in there, so you write
Object.entries(obj).forEach(([k,v]) => …)
or old school
for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
console.log(key, obj[key]);
}
}