Map.prototype.has()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itโs been available across browsers since โจ2015๋ 7์โฉ.
Map
์ธ์คํด์ค์ has()
๋ฉ์๋๋ ์ฃผ์ด์ง ํค์ ํด๋นํ๋ ์์์ ์กด์ฌ ์ฌ๋ถ๋ฅผ ๊ฐ๋ฆฌํค๋ ๋ถ๋ฆฌ์ธ ๊ฐ์ ๋ฐํํฉ๋๋ค.
์๋ํด ๋ณด๊ธฐ
const map1 = new Map();
map1.set("bar", "foo");
console.log(map1.has("bar"));
// Expected output: true
console.log(map1.has("baz"));
// Expected output: false
๊ตฌ๋ฌธ
js
has(key)
๋งค๊ฐ๋ณ์
key
-
Map
๊ฐ์ฒด์์ ์กด์ฌ๋ฅผ ํ์ธํ ์์์ ํค
๋ฐํ ๊ฐ
๋ง์ฝ ์ฃผ์ด์ง ํค์ ํด๋นํ๋ ์์๊ฐ Map
๊ฐ์ฒด์ ์กด์ฌํ๋ค๋ฉด true
, ๊ทธ๋ ์ง ์์ผ๋ฉด false
์์
has() ์ฌ์ฉํ๊ธฐ
js
const myMap = new Map();
myMap.set("bar", "foo");
console.log(myMap.has("bar")); // true
console.log(myMap.has("baz")); // false
๋ช ์ธ์
Specification |
---|
ECMAScriptยฎ 2026 Language Specification # sec-map.prototype.has |
๋ธ๋ผ์ฐ์ ํธํ์ฑ
Loadingโฆ