cannot be accessed directly. This value is actually a mapping of [[Entries]] within entries(), but there is a key => map array inside, which can be obtained using the following methods.
Method 1
var arr = [];
var map = new Map();
for(var [key, val] of map.entries()) {
arr.push([key, val]);
}
Method 2
var map = new Map();
Array.from(map);
The arrays output by the above two methods are similar:
[
[1, 'a'],
[2, 'b']
]
The first of each item is the key name, and the second is the key value.
cannot be accessed directly. This value is actually a mapping of
[[Entries]]
withinentries()
, but there is akey => map
array inside, which can be obtained using the following methods.Method 1
Method 2
The arrays output by the above two methods are similar:
The first of each item is the key name, and the second is the key value.