What is decrement (--) operator in JavaScript?

JavascriptWeb DevelopmentFront End Technology

The decrement operator decreases an integer value by one. Here’s an example where the value of a is decremented twice using decrement operator twice −

Example

Live Demo

<html>
   <body>
      <script>
         <!--
         var a = 33;
         a = --a;
         document.write("--a = ");
         result = --a;
         document.write(result);
      </script>
   </body>
</html>
raja
Published on 18-Jan-2018 09:03:06
Advertisements