Home  >  Article  >  Web Front-end  >  What does javascript % mean?

What does javascript % mean?

藏色散人
藏色散人Original
2021-11-11 17:30:186637browse

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.

What does javascript % mean?

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:

What does javascript % mean?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn