本文介绍了%在JavaScript中做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! %在JavaScript中做了什么?What does the % do in JavaScript?对它的定义及其作用将非常感激。A definition of what it is and what it does would be much appreciated.推荐答案这是 模运算符 即可。请参阅 文档 或 规范 有关JavaScript算术运算符的更多信息。It's a modulo operator. See this documentation or the specification for more information on JavaScript arithmetic operators. %(模数)模数运算符的用法如下:The modulus operator is used as follows: var1%var2var1 % var2模数运算符在前面的语句中返回第二个操作数的第一个操作数,即var1 modulo var2,其中 var1和var2是变量。模数函数是将var1除以var2的整数余数。例如,12%5返回2. 结果将与var1具有相同的符号;也就是说,-1%2返回-1。The modulus operator returns the first operand modulo the second operand, that is, var1 modulo var2, in the preceding statement, where var1 and var2 are variables. The modulo function is the integer remainder of dividing var1 by var2. For example, 12 % 5 returns 2. The result will have the same sign as var1; that is, −1 % 2 returns −1. 这篇关于%在JavaScript中做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的.. 09-07 03:10