From the docs I’ve been reading, the following ought to create an Array
from the keys of a Map
:
var m = new Map();
m.set("a", 1);
m.set("b", 2);
var arr1 = Array.from(m.keys());
var arr2 = Array.from(m.values());
console.log(arr1.length);
console.log(arr2.length);
I’d expect that to print 2
for both arrays, but in reality both arrays are empty and it prints 0
. What gives?