mattbasta mattbasta - 1 month ago 12
Javascript Question

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

I'm doing some work with the Parser API in Spidermonkey. The docs show that there's a binary operator

..
. Anybody have any idea what this is/does? I'd love to know. I've never seen it before. If I were forced to guess, I'd have to say it's something with E4X, but that's only because I know nothing about E4X.

Answer

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: