How can I use modulo operator (%) in JavaScript? [duplicate]

一世执手 提交于 2019-12-17 08:08:09

问题


How can I use modulo operator (%) in calculation of numbers for JavaScript projects?


回答1:


It's the remainder operator and is used to get the remainder after integer division. Lots of languages have it. For example:

10 % 3 // = 1 ; because 3 * 3 gets you 9, and 10 - 9 is 1.

Apparently it is not the same as the modulo operator entirely.




回答2:


That would be the modulo operator, which produces the remainder of the division of two numbers.



来源:https://stackoverflow.com/questions/16505559/how-can-i-use-modulo-operator-in-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!