Chapter 11JavaScript Math

Math in JavaScript

One of the primary capabilities that computers are renowned for is their ability to perform math very accurately and very quickly. All programming languages include features, constants, functions, and other math elements that allow the programmer to perform mathematics. Likewise, JavaScript includes many features related to math, enabling JavaScript programmers to invoke numeric calculations in our scripts. In this chapter we will explore these mathematical operations and show you ways to implement them in your web pages.

Math in JavaScript is based on two general elements of the language:

Mathematical ...

Get Advanced Javascript, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.