Modulus (division remainder) - Javascript Operator

Javascript examples for Operator:Arithmetic Operator

Description

Modulus (division remainder)

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*from   w  w  w  . j a v a2  s .c  o  m*/
    var x = 10;
    var y = 5;
    x %= y;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials