What is the "double tilde" (~~) operator in JavaScript?

JavascriptWeb DevelopmentFront End Technology

The “double tilde” (~~) operator is a double NOT Bitwise operator. Use it as a substitute for Math.floor(), since it’s faster.


You can try to run the following code to learn about double tilde operator −

         var a = 2;
         var b,c, d;

         b = ~~a;
         c = Math.floor(a);
         d = ~~b=== c;

         document.write("<br>"+d); // They are equal
Published on 19-Jan-2018 10:29:16