Answers for "how to convert map to array in js"

0

map to array javascript

let map = new Map().set('a', 1).set('b', 2),
    array = Array.from(map, ([name, value]) => ({ name, value }));

console.log(array);
Posted by: Guest on July-19-2021
0

javascript converting an array into a map

const arr = ['a', 'b', 'c', 2, 3, 4];
const nwMap = new Map([...arr.entries()]);
Posted by: Guest on July-12-2021

Code answers related to "how to convert map to array in js"

Browse Popular Code Answers by Language