What does the i--> opeator do in JavaScript?

javascript

Solution

`i-->0` is the same as `i-- > 0`, so the comparison expression if the evaluated value of `i--` is greater than `0`.

Problem

So I took a look at the code that controls the counter on the SO advertising page. Then I saw the line where this occured `i-->`. What does this do? Here is the full code: ``` $(function(){ var visitors = 5373891; var updateVisitors = function() { visitors++; var vs = visitors.toString(), i = Math.floor(vs.length / 3), l = vs.length % 3; while (i-->0) if (!(l==0&&i==0)) // <-------- Here it is!!! vs = vs.slice(0,i*3+l) + ',' + vs.slice(i*3+l); $('#devCount').text(vs); setTimeout(updateVisitors, Math.random()*2000); }; setTimeout(updateVisitors, Math.random()*2000); }); ```

Original source

Related problems