O'Reilly logo

Web Programming with HTML5, CSS, and JavaScript by Dean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

9.12 Arithmetic Operators

As stated earlier, it’s common for web pages to process strings, and that’s why JavaScript supports string processing with string operators and quite a few string methods. Likewise, it’s common for web pages to process numbers, and that’s why JavaScript supports number processing with arithmetic operators and quite a few math-computation methods. In this section, we describe JavaScript’s arithmetic operators.

Addition, Subtraction, Multiplication, and Division

JavaScript uses +, -, and * for addition, subtraction, and multiplication, respectively. They work the same as the addition, subtraction, and multiplication operators you learned in elementary school. The multiplication operator uses the asterisk and not ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required