-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathsymbol.jsdoc
More file actions
170 lines (117 loc) · 3.19 KB
/
Copy pathsymbol.jsdoc
File metadata and controls
170 lines (117 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
Symbol : Object
Symbols are an alternate to using %%/String|Strings%% as the
keys for properties. Symbols allow hiding properties on Objects
since you can only access the values if you have the same instance of the
Symbol.
You access a property with a Symbol key using
%%/Object#indexer_Symbol|object[symbol]%%.
Version:
ECMAScript 2015
Primitive:
true
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol-objects
----
Symbol([description : String]) : Symbol
Creates a new Symbol with an optional description.
<example>
var myObject = { foo: 'bar' };
var mySymbol = Symbol('MySymbol');
myObject[mySymbol] = 'baz';
console.log(myObject[mySymbol]);
// The property cannot be accessed using a string
console.log(myObject['MySymbol']);
</example>
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol-description
----
instance.description : String
Returns the description passed to the Symbol during construction.
<example>
var mySymbol = Symbol('MySymbol');
console.log(mySymbol.description);
</example>
Spec:
https://tc39.es/ecma262/#sec-symbol.prototype.description
Version:
ECMAScript 2019
----
asyncIterator : Symbol
Spec:
https://tc39.es/ecma262/#sec-symbol.asynciterator
----
hasInstance : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.hasinstance
----
isConcatSpreadable : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.isconcatspreadable
----
iterator : Symbol
The Symbol that retrieves a function that returns an
%%/Iterator|iterator%% for the Object.
<example>
// Array's iterator function is also exposed as 'values'
var arrayIterator = Array.prototype[Symbol.iterator];
console.log(arrayIterator === Array.prototype.values);
var x = ['a', 'b', 'c'];
// The following are all equivalent:
for (var item of x[Symbol.iterator]()) {
console.log(item);
}
// for (... of ...) automatically invokes the iterator function
for (var item of x) {
console.log(item);
}
// Array[Symbol.iterator] is also available through Array.values
for (var item of x.values()) {
console.log(item);
}
</example>
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.iterator
----
match : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.match
----
matchAll : Symbol
Spec:
https://tc39.es/ecma262/#sec-symbol.matchall
----
replace : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.replace
----
search : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.search
----
species : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.species
----
split : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.split
----
toPrimitive : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.toprimitive
----
toStringTag : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.tostringtag
----
unscopables : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.unscopables
----
for(key : String) : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.for
----
keyFor(key : String) : Symbol
Spec:
http://www.ecma-international.org/ecma-262/10.0/#sec-symbol.for