The downto operator - an ES7 proposal


#1

I had posted about this two years back when it was scheduled for ES6 but this feature did not get accepted then. But now, it's been finally accepted by the committee in the ES7 proposal!
(ES6 and ES7 are the next version's of JavaScript; read more)

That's awesome! What does it do?

It's a very simple operator, and best explained by an example:

var i = 10;

while(i --> 0)     // '-->' is the downto operator
   console.log(i);

As you can see, this operator is used with loops. It basically says that loop till i goes down to a limit, which in this case is the number 0.

This operator makes our code very easy to read and understand, and I am glad it's coming in ES7.

What are your thoughts about it? Do you like it? Discuss below! :slight_smile:


#2

Wow! That's awesome. Can we use it in our code already??? :hushed:


#3

It works! https://repl.it/CBWh/0


#4

repl.it usually implements the proposal's quickly, like this one, so that we coders can experiment with them :tada: :tada: :smiley:


#5

I like it!  


#6

I think Codecademy have updated so that it works here too :smiley: :confetti_ball:


#7

Yes! Thank you Codecademy team!