• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Arithmetic Operators

As you can see in Table 2.6, the arithmetic operators enable you to work on numeric values, adding them (with the + operator), subtracting them (with the operator), multiplying them (with the * operator), dividing them (with the / operator), and so on. We’ve already see these operators at work; here’s an example we saw using the / operator to convert pounds to kilograms:

<HTML> 
    <HEAD> 
        <TITLE> 
            Working With Operators 
        </TITLE> 
    </HEAD> 

    <BODY> 
        <H1>Working With Operators</H1> 
        <SCRIPT LANGUAGE="JavaScript"> 
        <!--
            var pounds = 5.0
					var kilograms = pounds / 2.2046
					document.write(pounds + " pounds = " + kilograms + " kilograms.") 
        // --> 
        </SCRIPT> 
     </BODY> 
</HTML> 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint