| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Set/Set | [Back] [Original] |
Get to know MDN better
const set = new Set([1, 2, 3, 4, 5]);
console.log(set.has(1));
// : true
console.log(set.has(5));
// : true
console.log(set.has(6));
// : false
new Set()
new Set(iterable)
iterable null Set
Set
Set const mySet = new Set();
mySet.add(1); // Set [ 1 ]
mySet.add(5); // Set [ 1, 5 ]
mySet.add(5); // Set [ 1, 5 ]
mySet.add("some text"); // Set [ 1, 5, 'some text' ]
const o = { a: 1, b: 2 };
mySet.add(o);
| ECMAScript 2027 LanguageSpecification # sec-set-constructor |
| Web Proxy Viewer | New URL | Original Page |