Set.prototype
The Set
.prototype
property represents the prototype for the Set
constructor.
Атрибуты свойстваSet.prototype |
|
---|---|
Записываемое | нет |
Перечисляемое | нет |
Настраиваемое | нет |
Description
Set
instances inherit from Set.prototype
. You can use the constructor's prototype object to add properties or methods to all Set
instances.
Свойства
Set.prototype.constructor
- Возвращает функцию, которая создала прототип экземпляра. Это функция
Set
по умолчанию. Set.prototype.size
- Возвращает количество элементов в объекте
Set
.
Методы
Set.prototype.add(value)
- Добавляет новый элемент с переданным значением в
Set
объект. ВозвращаетSet
объект. Set.prototype.clear()
- Removes all elements from the
Set
object. Set.prototype.delete(value)
- Removes the element associated to the
value
and returns the value thatSet.prototype.has(value)
would have previously returned.Set.prototype.has(value)
will returnfalse
afterwards. Set.prototype.entries()
- Returns a new
Iterator
object that contains an array of[value, value]
for each element in theSet
object, in insertion order. This is kept similar to theMap
object, so that each entry has the same value for its key and value here. Set.prototype.forEach(callbackFn[, thisArg])
- Calls
callbackFn
once for each value present in theSet
object, in insertion order. If athisArg
parameter is provided toforEach
, it will be used as thethis
value for each callback. Set.prototype.has(value)
- Returns a boolean asserting whether an element is present with the given value in the
Set
object or not. Set.prototype.keys()
(en-US)- Is the same function as the
values()
function and returns a newIterator
object that contains the values for each element in theSet
object in insertion order. Set.prototype.values()
- Returns a new
Iterator
object that contains the values for each element in theSet
object in insertion order. Set.prototype[@@iterator]()
(en-US)- Returns a new
Iterator
object that contains the values for each element in theSet
object in insertion order.
Specifications
Specification | Status | Comment |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) Определение 'Set.prototype' в этой спецификации. |
Стандарт | Initial definition. |
ECMAScript (ECMA-262) Определение 'Set.prototype' в этой спецификации. |
Живой стандарт |
Browser compatibility
No compatibility data found for javascript.builtins.Set.prototype
.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.