| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Set/delete | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.
Set delete() Set Set .
const set1 = new Set();
set1.add({ x: 10, y: 20 }).add({ x: 20, y: 30 });
// Delete any point with `x > 10`.
set1.forEach((point) => {
if (point.x > 10) {
set1.delete(point);
}
});
console.log(set1.size);
// Expected output: 1
setInstance.delete(value)
valueSet .
value Set true,
false.
delete() const mySet = new Set();
mySet.add("foo");
console.log(mySet.delete("bar")); // false; "bar" .
console.log(mySet.delete("foo")); // true; .
console.log(mySet.has("foo")); // false; "foo" .
.
const setObj = new Set(); // Set .
setObj.add({ x: 10, y: 20 }); // Set .
setObj.add({ x: 20, y: 30 }); // Set .
// `x > 10` point .
setObj.forEach((point) => {
if (point.x > 10) {
setObj.delete(point);
}
});
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-set.prototype.delete |
This page was last modified on 2025 2 11 by MDN contributors.
SetSet.prototype.add()Set.prototype.clear()Set.prototype.delete()Set.prototype.difference()Set.prototype.entries()Set.prototype.forEach()Set.prototype.has()Set.prototype.intersection()Set.prototype.isDisjointFrom()Set.prototype.isSubsetOf()Set.prototype.isSupersetOf()Set.prototype.keys()Set.prototype.symmetricDifference()Set.prototype.union()Set.prototype.values()Set.prototype[@@iterator]()Object/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |