Перевод не завершен. Пожалуйста, помогите перевести эту статью с английского.
Это экспериментальная технология, часть предложения Harmony (ECMAScript 6).
Поскольку спецификация этой технологии ещё не стабилизировалась, проверьте таблицу совместимости её использования в различных браузерах. Также обратите внимание, что синтаксис и поведение экспериментальной технологии могут быть изменены в будущих версиях браузеров в соответствии с изменениями в спецификации.
Свойство Map
.prototype
представляет собой прототип конструктора Map
.
Атрибуты свойстваMap.prototype |
|
---|---|
Записываемое | нет |
Перечисляемое | нет |
Настраиваемое | нет |
Описание
Экземпляры Map
наследуются от Map.prototype
. You can use the constructor's prototype object to add properties or methods to all Map
instances.
Свойства
Map.prototype.constructor
- Returns the function that created an instance's prototype. This is the
Map
function by default. Map.prototype.size
- Возвращает количество пар key/value, содержащихся в объекте
Map
.
Методы
Map.prototype.clear()
- Удаляет все пары key/value из объекта
Map
. Map.prototype.delete(key)
- Removes any value associated to the
key
and returns the value thatMap.prototype.has(value)
would have previously returned.Map.prototype.has(key)
will returnfalse
afterwards. Map.prototype.entries()
- Returns a new
Iterator
object that contains an array of[key, value]
for each element in theMap
object in insertion order. Map.prototype.forEach(callbackFn[, thisArg])
- Calls callbackFn once for each key-value pair present in the
Map
object, in insertion order. If a thisArg parameter is provided to forEach, it will be used as the this value for each callback. Map.prototype.get(key)
- Returns the value associated to the
key
, orundefined
if there is none. Map.prototype.has(key)
- Returns a boolean asserting whether a value has been associated to the
key
in theMap
object or not. Map.prototype.keys()
- Returns a new
Iterator
object that contains the keys for each element in theMap
object in insertion order. Map.prototype.set(key, value)
- Устанавлиевает value для
key
в объектеMap
. Возвращает объектMap
. Map.prototype.values()
- Returns a new
Iterator
object that contains the values for each element in theMap
object in insertion order. Map.prototype[@@iterator]()
- Returns a new
Iterator
object that contains an array of[key, value]
for each element in theMap
object in insertion order.
Спецификации
Спецификация | Статус | Комментарии |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) Определение 'Map.prototype' в этой спецификации. |
Стандарт | Initial definition. |
Совместимость с браузерами
Возможность | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Базовая поддержка | 38 | 13 (13) | 11 | 25 | 7.1 |
Возможность | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Базовая поддержка | Нет | 38 | 13.0 (13) | Нет | Нет |
8 |