The Unary Negation Operator is used to convert the operand into a number. After that it negates.
Example
You can try to run the following code to learn how to work with Unary Negation Operator in JavaScript −
Live Demo
<html> <body> <script> var a = true; var b = '0xFF'; var c = "false"; var c, d, e; var linebreak = "<br />"; c = -a; d = -b; e = -c; document.write("-true = "+c); document.write(linebreak); document.write("-'0xFF' = " +d); document.write(linebreak); document.write("-false = " +e); </script> </body> </html>