JavaScript Math Object Reference Chart Cheat Sheet
This is part thirteen of the JavaScript tutorial. If you missed the previous lessons, you may want to review them prior to viewing this JavaScript Math Object Reference Chart.
The JavaScript math object reference chart below, also known a a “cheat sheet,” provides a great way for you to copy and paste the math object code you need into your JavaScript coding.
JavaScript Math Object Reference
Method |
Description |
abs(a) |
Supplies the absolute value of a number |
acos(a) |
Supplies the arccosine of a number |
asin(a) |
Supplies the arcsine of a number |
atan(a) |
Supplies the arctangent of a as a numeric value between -PI/2 and PI/2 radians |
atan2(a,b) |
Supplies the angle theta of a point as a numeric value between -PI and PI radians |
ceil(a) |
Supplies the value of a number rounded up to the nearest number |
cos(a) |
Supplies the cosine of a number |
exp(a) |
Supplies the exponential value of a number |
floor(a) |
Supplies the value of a number rounded down to the nearest number |
log(a) |
Supplies the logarithm of a number |
max(a,b) |
Supplies the number with the highest value |
min(a,b) |
Supplies the number with the lowest value |
pow(a,b) |
Supplies the value of one number (a) to the power of the second number (b) |
random( ) |
Supplies a random number between 0 and 9 |
round(a) |
Supplies a number rounded to the nearest number |
sin(a) |
Supplies the sine of a number |
sqrt(a) |
Supplies the square root of a number |
tan(a) |
Supplies the tangent of an angle |
toSource(a) |
Refers to the source code of an object |
valueOf( ) |
Supplies the primitive value of a math object |
This JavaScript code cheat sheet for your math objects will enable you to copy and paste your needed JavaScript code into your script.
This concludes the JavaScript Math Object Reference Chart. In the next section, you will find a JavaScript Array Object Reference Chart.