Working with JavaScript Operators

What if you wanted to manipulate your data in JavaScript code? Say, for example, that you needed to multiple 219 by 45—how would you do it? In JavaScript, you can use the multiplication operator (*). Here's an example showing how this works:

Listing . ch06_05.html
            Using Operators In JavaScript

                Using Operators In JavaScript

        <SCRIPT LANGUAGE="JavaScript">
            var result
					result = 219 * 45
					document.writeln("219 * 45 = " +  result)

You can see the results of this code in Figure 6-5.

Figure 6-5. Using JavaScript operators in Internet Explorer.

As you might expect, there are many operators available in JavaScript. For ...

Get Real World XML now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.