Movatterモバイル変換


[0]ホーム

URL:


  1. 개발자를 위한 웹 기술
  2. JavaScript
  3. JavaScript 참고서
  4. 표준 내장 객체
  5. Map
  6. Map.prototype.delete()

This page was translated from English by the community.Learn more and join the MDN Web Docs community.

View in EnglishAlways switch to English

Map.prototype.delete()

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 인스턴스의delete() 메서드는 이 Map 에서 특정 요소를 제거합니다.

시도해 보기

const map1 = new Map();map1.set("bar", "foo");console.log(map1.delete("bar"));// Expected result: true// True indicates successful removalconsole.log(map1.has("bar"));// Expected result: false

구문

js
delete(key)

매개변수

key

Map 객체에서 제거할 요소의 키

반환 값

Map 객체에서 요소가 존재하고 제거된 경우true, 그렇지 않고 해당 요소가 존재하지 않으면false를 반환합니다.

예제

delete() 사용하기

js
const myMap = new Map();myMap.set("bar", "foo");console.log(myMap.delete("bar")); // true를 반환합니다. 성공적으로 제거되었습니다.console.log(myMap.has("bar")); // false를 반환합니다. "bar" 요소는 더 이상 존재하지 않습니다.

명세서

Specification
ECMAScript® 2026 Language Specification
# sec-map.prototype.delete

브라우저 호환성

같이 보기

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp