What is the double-dot operator (..) in Javascript? What is the double-dot operator (..) in Javascript? javascript javascript

What is the double-dot operator (..) in Javascript?


Not to be confused with the decimal point and dot:

var val= 1000..toExponential()


It is an E4X operator.

From https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide:Processing_XML_with_E4X:

While the . operator accesses direct children of the given node, the .. operator accesses all children no matter how deeply nested:


Something like:

255..toString(16);

First dot is actually a decimal point, just let JavaScript Compiler know the second dot wants to invoke property or method. And 255.toString(16) makes JavaScript Compiler confused(identifier starts immediately after decimal numeric literal).