Lets say I have the following map:
let myMap = new Map().set(\'a\', 1).set(\'b\', 2);
And I want to obtain [\'a\', \'b\'] based on the abov
Not exactly best answer to question but this trick new Array(...someMap) saved me couple of times when I need both key and value to generate needed array. For example when there is need to create react components from Map object based on both key and value values.
let map = new Map();
map.set("1", 1);
map.set("2", 2);
console.log(new Array(...map).map(pairs => pairs[0])); -> ["1", "2"]