1.Arithmetic Operators Example-1(Addition,substraction,multiplication,division):
The two numbers can be literals Example-(1)
<script>
var x = 100 + 50;
document.getElementById("demo").innerHTML = x;
</script>
<script> var a = 100; var b = 50; var x = a + b; document.getElementById("demo").innerHTML = x; </script>
<script> var a = 3; var x = (100 + 50) * a; document.getElementById("demo").innerHTML = x; </script>
<script> var x = 5; var y = 2; var z = x + y; document.getElementById("demo").innerHTML = z; </script>
<script> var x = 5; var y = 2; var z = x - y; document.getElementById("demo").innerHTML = z; </script> // multiplication <script> var x=5; var y=2; var z=x*y;// we can do division here document.getElementById("demo").innerHTML=z; </script>
<script> var x = 5; x++; var z = x; document.getElementById("demo").innerHTML = z; </script> //decrement
<script> var x = 5; x--; var z = x; document.getElementById("demo").innerHTML = z; </script> //Multiplication has precedence over addition
<script> document.getElementById("demo").innerHTML = 100 + 50 * 3; </script>