Skip to content Skip to sidebar Skip to footer

What Is The Javascript `-->` Operator?

I saw some code online and it had this in it: What exactly is this --> operator and what does it do?

Solution 1:

There isn't a --> operator.

That is just a Postfix Decrement Operator immediately followed by a Greater Than Operator.

It would more usually be written as:

for (var i = 10; i-- > 0;) { 

Solution 2:

It is a decrement (--) followed by a comparison (>). These would normally be written with a space to make it easier to read.

Post a Comment for "What Is The Javascript `-->` Operator?"