O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

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

Math Operations

JavaScript has a built-in Math object that provides functionality for extended mathematical operations. The Math object has property values, listed in Table 2.2, that contain the most common constants. You can access the Math object directly from your JavaScript code. For example, to get the value of pi, you would use the following:

Math.PI

Image

Table 2.2 Math Object Properties

The Math object also includes several methods that allow you to apply higher math operations. The following sections provide phrases for those operations.

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