Home > Article > Web Front-end > What does javascript % mean?
javascript % is the modulo operator, which is used to perform modulo between numbers, that is, remainder calculation. Its usage method is such as "x%y", and the return value is the remainder.

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.
javascript What does % mean?
javascript % is the modulo operator, which is an arithmetic operator in JavaScript.
Javascript arithmetic operators are used to perform arithmetic operations on numbers:

Usage example:
<script>
function mo(x,y){
return x%y;
}
console.log(mo(5,2));
</script>The operation result is: 1, also It means that the remainder is 1
Recommended study: "javascript basic tutorial"
The above is the detailed content of What does javascript % mean?. For more information, please follow other related articles on the PHP Chinese website!