JavaScript如何处理模数? [英] How does JavaScript handle modulo?
本文介绍了JavaScript如何处理模数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道JavaScript如何处理模数.例如,JavaScript将47 % 8
评估为什么?我似乎找不到任何文档,我的模数技能也不是最好的.
I was wondering how JavaScript handles modulo. For example, what would JavaScript evaluate 47 % 8
as? I can’t seem to find any documentation on it, and my skills on modulo aren’t the best.
推荐答案
正是每种语言都以模数处理:X / Y
的其余部分.
Exactly as every language handles modulo: The remainder of X / Y
.
47 % 8 == 7
另外,如果您使用的浏览器是Firefox + Firebug,Safari,Chrome或IE8 +,则可以像按F12一样快速地测试这种操作.
Also if you use a browser like Firefox + Firebug, Safari, Chrome, or even IE8+ you could test such an operation as quickly as hitting F12.
这篇关于JavaScript如何处理模数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文