[...someVariable] it's actually spread attribute not operator.
As you know ... are called Spread Attributes which the name represents it allows an expression to be expanded.
var parts = ['two', 'three'];
var numbers = ['one', ...parts, 'four', 'five']; // ["one", "two", "three", "four", "five"]
And in this case(I'm gonna simplify it).
//just assume we have an object
The term "spread attribute" is mostly used by React/JSX. Not that it really matters, but the most correct terminology would probably just be "spread syntax" (the ECMAScript spec only refers to it as "SpreadElement" in its grammar).
Interesting... heh - so, on that page it's called all four of these things:
... and it seems to all refer to the same thing :)
I've also found "official" docs calling it at least three of those things 🤣
Is there an actual "official, for real" source for what it's called?
I believe, operators need operand(s).
ECMA divided this topic to:
Hm, interesting. Does the variable that the three dots are on not count as an operand? (I don't know what the formal definition is)
Somehow yes, but I think because this '...' thing introduced the time that syntactic sugar came up to JS so they tend to keep it as just helper syntax, some developers don't like it to be called as an operator because of other programming languages same debate.(some folks in this way would say one language has got more operators to another...:-))
Got, it (I think :) ). Interesting! I wasn't aware of the debate over the "operator" word. Thanks :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.