什么是i - > opeator在JavaScript中做什么? [英] What does the i--> opeator do in JavaScript?

查看:107
本文介绍了什么是i - > opeator在JavaScript中做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我看了一下在SO广告页面上控制计数器的代码。然后我看到了这个出现的行 i - > 。这是做什么的?

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?

以下是完整代码:

$(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);

});


推荐答案

i - > 0 i - >相同0 ,所以如果 i - 的评估值大于 0 。

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

这篇关于什么是i - &gt; opeator在JavaScript中做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆