Number Subtraction - Javascript Operator

Javascript examples for Operator:Arithmetic Operator

Description

Number Subtraction

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 ww  .  jav  a2s . com*/
    var y = 5;
    var x = y - 2;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials