JS测试是否为10的倍数 [英] JS test if multiple of 10

查看:63
本文介绍了JS测试是否为10的倍数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用setIntervall的JS函数中,我想每10个循环执行一次jquery动画(在其他9个循环中,正在显示其他动画).

In a JS function using setIntervall, I want to perform a jquery animation every 10 loops (in the other 9 loops, other animations are being displayed).

我在函数中使用变量i,每个循环它使+1递增.如果我是10的倍数(为了执行我的jquery动画),是否有一种非常简单的方法来检查javascript?

I am using the variable i in my function and it increments +1 each loop. Is there a very easy way to check in javascript if i is a multiple of 10 (in order to perform my jquery animation)?

在PHP中,我只是做 if(($ i%10)== 0) ...但是我在JS中找不到它.

In PHP I would simply do if(($i % 10) == 0) ... but I didn't find it in JS.

推荐答案

您尝试过吗?我发现一些网站声称相同的运算符将在JavaScript中运行.

Did you try it? I found a few sites that claim that the same operator % will work in JavaScript.

这篇关于JS测试是否为10的倍数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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