Unary Negation : Arithmetic operator : Operators JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Operators » Arithmetic operator »

 

Unary Negation







If the value is a string, an attempt is made to convert the string to a number.












<html>
    <script language="JavaScript">
    <!--
    aString = new String("36");
    answer = -aString;
    document.write("answer = -aString<br>");
    document.write("answer = ",answer);
    -->
    </script>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Operators
» Arithmetic operator