Home > Web Front-end > Front-end Q&A > What does javascript % mean?

What does javascript % mean?

藏色散人
Release: 2021-11-11 17:30:18
Original
6646 people have browsed it

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template