Map[@@species]
accessor property returns the
Map
构造函数。
The species accessor property returns the default constructor for
Map
objects. Subclass constructors may over-ride it to change the constructor assignment.
The species property returns the default constructor function, which is the
Map
constructor for
Map
对象:
Map[Symbol.species]; // function Map()
In a derived collection object (e.g. your custom map
MyMap
), the
MyMap
species is the
MyMap
constructor. However, you might want to overwrite this, in order to return parent
Map
objects in your derived class methods:
class MyMap extends Map {
// Overwrite MyMap species to the parent Map constructor
static get [Symbol.species]() { return Map; }
}
| 规范 |
|---|
|
ECMAScript (ECMA-262)
The definition of 'get Map [ @@species ]' in that specification. |
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@species
|
Chrome 51 | Edge 13 | Firefox 41 | IE No | Opera 38 | Safari 10 | WebView Android 51 | Chrome Android 51 | Firefox Android 41 | Opera Android 41 | Safari iOS 10 | Samsung Internet Android 5.0 |
nodejs
6.5.0
|
完整支持
不支持
用户必须明确启用此特征。
Map
Map.prototype.size
Map.prototype[@@toStringTag]
get Map[@@species]
Function
Object
Object.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.toSource()
Object.prototype.toString()
Object.prototype.valueOf()
Object.setPrototypeOf()