What are the newest operators added to Javascript? [closed]
Asked Answered
C

2

0

I would like to know which operators were added to Javascript most recently.

This includes any operators which might not have got all the way through the standards process to being implemented in all browsers, if it's more or less certain they will be.

If no new operators have been added very recently then I'd still like to know how long ago the last couple of new ones did make it in.

Since first asking this question half an hour ago, I've already learned that there are syntactic features of JavaScript that are commonly referred to as "operators" but that may not technically qualify as operators. In light of this I'd like this question to cover the broad sense of the term.

Central answered 27/1, 2016 at 4:25 Comment(10)
Just compare the spec revisions against each other. What research have you done yet?Trudi
What kind of syntax do you consider an "operator"?Trudi
@Bergi: Only what EcmaScript officially consider to be operators.Central
You really ought to just go read one of the thousands of "What's new in ES6?" (or sometimes called ES2015) articles and then ask a much more specific question (if you need to) after reading. Here are a couple summaries of new things: babeljs.io/docs/learn-es2015 and github.com/lukehoban/es6featuresInclement
I was only interested in operators and I was interested whether there were new ones in ES6 or whether the last new ones were years ago.Central
Close votes because the answer is so obvious? If so why do the two answers no agree? Do the differences not even deserve elaboration?Central
Well now that it's clear not everybody has the same understanding of what is an operator in JS I'm increasingly unsure about my answer in my first comment. \-: Please allow me to tweak my question now that you've helped me see what could technically be misuse of the term "operator".Central
@hippietrail: "What is an operator?" would probably make a much better (although slightly opinion-based) question than this.Trudi
Well that would be a whole separate question. I'm still interested in the development of the set of "operators" in JS.Central
@Bergi: OK I've taken your advice and also asked a new question on clarification of this term: stackoverflow.com/questions/35029217Central
T
2

Considering ES6 as the latest standard, the "newest" operators are the strict equality and non-equality operators (===, !==) that were introduced with ES3. Later revisions of the standard added new syntax, but none of them did bring new operators.

Trudi answered 27/1, 2016 at 4:41 Comment(3)
Hmm so is es6-features.org wrong to describe the spread operator and iteration & for-of operators as such?Central
Hm, the spread operator is nicknamed as such often, because it looks like a unary operator, but technically it's only an extension of the array literal / function argument list syntax. It's not a stand-alone operator that makes an expression, and cannot be "applied" anywhere. for of definitely is a statement, not an operator.Trudi
You'll also be interested in this thread that lines out how spread would be expected to work as an operator…Trudi
C
-2

Well there are some in EcmaScript 6 that I wasn't even aware of until I wondered this and started looking for an answer.

The "spread operator": ...


The site es6-features.org "ES6 ECMAScript 6 — New Features: Overview & Comparison" also lists an "Iterator & For-Of Operator".


I'm just reading up on these now myself so forgive me for not including brief descriptions just yet ...

Central answered 27/1, 2016 at 4:40 Comment(3)
Neither ... spread syntax nor for of loops are considered operators by ES6.Trudi
Confusing. Seems like all the more reason to take this opportunity to say something clear about the actual situation.Central
@Bergi—today I discovered that the Introduction to ECMAScript 2018 includes "It also includes rest parameter and spread operator support…". In the normative part it's called SpreadElement. Just sayin'. :-)Piragua

© 2022 - 2024 — McMap. All rights reserved.