| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Map/get | [Back] [Original] |
Get to know MDN better
const map = new Map();
map.set("bar", "foo");
console.log(map.get("bar"));
// : "foo"
console.log(map.get("baz"));
// : undefined
get(key)
Map undefined
const myMap = new Map();
myMap.set("bar", "foo");
console.log(myMap.get("bar")); // "foo"
console.log(myMap.get("baz")); // undefined
const arr = [];
const myMap = new Map();
myMap.set("bar", arr);
myMap.get("bar").push("foo");
console.log(arr); // ["foo"]
console.log(myMap.get("bar")); // ["foo"]
| ECMAScript 2027 LanguageSpecification # sec-map.prototype.get |
| Web Proxy Viewer | New URL | Original Page |