Skip to content

Instantly share code, notes, and snippets.

@DasolPark
Created October 6, 2021 12:12
// Iterable keys
// importance: 5
// We’d like to get an array of map.keys() in a variable and then apply array-specific methods to it, e.g. .push.
// But that doesn’t work:
let map = new Map();
map.set("name", "John");
let keys = Array.from(map.keys());
// Error: keys.push is not a function
keys.push("more");
console.log(keys);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment