9.13 Math Object Methods
To make processing numbers easier, JavaScript has more than 30 methods that perform mathematical operations. We don’t want to overwhelm you with all of them. In this section, we present the ones that tend to be used most often. In the last section, we introduced you to the Math.PI constant, which is a property of the Math object. This section’s methods, not surprisingly, are members of the Math object as well.
Take a look at the Math methods in FIGURE 9.17. They’re all pretty straightforward, but one thing you should be aware of is that if you use a variable for one of the arguments, the method calculates a value as described in the figure and returns that calculated value, but the argument variable’s value doesn’t ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access