[JS] Convert an object to an map
Simple example of convert an object to a map.
let obj = {
name: "John",
age: 30,
};
let map = new Map(Object.entries(obj));
console.log(obj);
console.log(map);
console.log(map.get("name"));
Simple example of convert an object to a map.
let obj = {
name: "John",
age: 30,
};
let map = new Map(Object.entries(obj));
console.log(obj);
console.log(map);
console.log(map.get("name"));
Comments