Kim Gysen Kim Gysen - 1 year ago 71
Javascript Question

Convention of @@

What is the convention behind the double at (

) in method declarations?

For example from:

Whenever an object needs to be iterated (such as at the beginning of a
for..of loop), its @@iterator method is called with no arguments, and
the returned iterator is used to obtain the values to be iterated.

Answer Source

That's a specification shorthand for "well-known symbols," rather than something you'd type literally. For instance, @@iterator is Symbol.iterator, which is the key you'd use to get the default iterator for an object:

let defaultIterator = theObject[Symbol.iterator];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download