Computer >> Computer tutorials >  >> Programming >> Javascript

What is Subtraction Operator (-) in JavaScript?


Subtraction Operator subtracts the second operand from the first.

Example

You can try to run the following code to work with Subtraction Operator −

Live Demo

<html>
   <body>
      <script>
         var a = 40;
         var b = 25;

         document.write("a - b = ");
         result = a - b;
         document.write(result);
      </script>
   </body>
</html>