[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Set/difference [Back]  [Original]

Set.prototype.difference() - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Set.prototype.difference()

Baseline 2024

20246

difference() Set Set Set

js
difference(other)

other

Set Set

Set Set other

(difference)

AB={xAxB}A\setminus B = \{x\in A\mid x\notin B\}

2 A  B A  B [2 A B A B ]

difference() Set other this this Set this other

  • this other.size other keys() this other Set
  • this this e other.has(e) Set

Set this

difference()

10 10

js
const odds = new Set([1, 3, 5, 7, 9]);
const squares = new Set([1, 4, 9]);
console.log(odds.difference(squares)); // Set(3) { 3, 5, 7 }

ECMAScript 2027 LanguageSpecification
# sec-set.prototype.difference


Web Proxy Viewer  |  New URL  |  Original Page