js Map to object array code example
Example 1: object to map javascript
const map = new Map(Object.entries({foo: 'bar'}));
map.get('foo'); // 'bar'
Example 2: typescript map list to new list of objects
var result = arr.map(person => ({ value: person.id, text: person.name }));
console.log(result)
Example 3: javascript map to object
Object.fromEntries(Map)
Example 4: use map to loop through an array
let squares = [1,2,3,4].map(function (val) {
return val * val;
});
// squares will be equal to [1, 4, 9, 16]