JavaScript Math Methods

Beginner
6 min read
Updated: Nov 2026
45 guides
Method index

About This Index

This page is the JavaScript Math Methods index for the tutorial track. Each row links to a full guide with syntax, simple examples, and FAQs.

The Math object is built into JavaScript — no import needed. Jump to abs(), round(), sqrt(), or random() when you need a specific API.

Beginner path.

Start with abs(), floor(), ceil(), round(), max(), min(), and random() — then open trig and constants like Math.PI.

How to Call a Math Method

All Math APIs are static. Call them on Math, not on a number instance:

JavaScript
// Methods (need parentheses)
Math.abs(-7);           // 7
Math.round(4.6);        // 5
Math.floor(4.9);        // 4
Math.sqrt(25);          // 5
Math.max(3, 9, 1);      // 9
Math.random();          // 0 <= n < 1

// Constants (no parentheses)
Math.PI;                // 3.14159...
Math.E;                 // 2.71828...

JavaScript Math Methods Table

All Math guides in this JavaScript tutorial series (45 tutorials).

Everyday Math

12 items

Absolute value, rounding, min/max, powers, roots, and random numbers — start here.

NameDescriptionTutorial
abs()Return the absolute value of a number — negatives become positive.Open
ceil()Round a number up to the next whole number.Open
floor()Round a number down to the previous whole number.Open
round()Round a number to the nearest whole number.Open
trunc()Remove the fractional part of a number (toward zero).Open
sign()Return −1, 0, or 1 depending on the sign of a number.Open
max()Return the largest of zero or more numbers.Open
min()Return the smallest of zero or more numbers.Open
pow()Raise a base to a power (base^exponent).Open
sqrt()Return the square root of a non-negative number.Open
cbrt()Return the cube root of a number.Open
random()Return a random number greater than or equal to 0 and less than 1.Open

Trigonometry

7 items

Sine, cosine, tangent, and inverse functions. Angles use radians (not degrees).

NameDescriptionTutorial
sin()Return the sine of an angle given in radians.Open
cos()Return the cosine of an angle given in radians.Open
tan()Return the tangent of an angle given in radians.Open
asin()Return the arcsine of a number in radians (input between −1 and 1).Open
acos()Return the arccosine of a number in radians (input between −1 and 1).Open
atan()Return the arctangent of a number in radians.Open
atan2()Return the angle of a point (y, x) from the positive x-axis, in radians.Open

Hyperbolic Functions

6 items

Hyperbolic sine, cosine, tangent, and their inverses.

NameDescriptionTutorial
sinh()Return the hyperbolic sine of a number.Open
cosh()Return the hyperbolic cosine of a number.Open
tanh()Return the hyperbolic tangent of a number.Open
asinh()Return the hyperbolic arcsine of a number.Open
acosh()Return the hyperbolic arccosine of a number (≥ 1).Open
atanh()Return the hyperbolic arctangent of a number (between −1 and 1).Open

Exponentials and Logarithms

6 items

eˣ, natural and base-2/10 logs, plus accurate near-zero helpers.

NameDescriptionTutorial
exp()Return e raised to the power of a number (eˣ).Open
expm1()Return eˣ − 1 accurately for values near zero.Open
log()Return the natural logarithm (base e) of a number.Open
log10()Return the base-10 logarithm of a number.Open
log2()Return the base-2 logarithm of a number.Open
log1p()Return ln(1 + x) accurately for values near zero.Open

Numeric Helpers

6 items

Distances, integer multiply, float rounding, and bit counting.

NameDescriptionTutorial
hypot()Return the square root of the sum of squares — useful for distances.Open
imul()Multiply two numbers as 32-bit integers (C-like).Open
fround()Round a number to the nearest 32-bit float (float32).Open
f16round()Round a number to the nearest 16-bit float (float16).Open
clz32()Count leading zero bits in a 32-bit integer representation.Open
sumPrecise()Sum numbers with higher floating-point precision (newer API).Open

Math Constants

8 items

Built-in constants on the Math object — no parentheses, just read the value.

NameDescriptionTutorial
EEuler’s number constant ≈ 2.71828.Open
LN10Natural logarithm of 10 ≈ 2.302585.Open
LN2Natural logarithm of 2 ≈ 0.693147.Open
LOG10EBase-10 logarithm of e ≈ 0.434294.Open
LOG2EBase-2 logarithm of e ≈ 1.442695.Open
PIPi constant ≈ 3.14159 — circle circumference / diameter.Open
SQRT1_2Square root of ½ ≈ 0.707106.Open
SQRT2Square root of 2 ≈ 1.41421.Open

Frequently Asked Questions

Math is a built-in object with static methods and constants for common math: Math.abs(), Math.round(), Math.sqrt(), Math.random(), Math.PI, and many more. You never create new Math() — just call Math.methodName().
No. Math is a global object in browsers and Node.js. Call Math.abs(-5) anywhere in your JavaScript code.
Radians. For example Math.sin(Math.PI / 2) is 1. Convert degrees with degrees * Math.PI / 180.
Number methods format or check a single number (toFixed, isInteger). Math methods compute values from numbers you pass in (abs, floor, pow, max).
Open abs(), round(), floor(), sqrt(), and random() first. Then browse trigonometry and constants like Math.PI from the tables below.

Start with abs()

Open the absolute-value guide—syntax, examples, and FAQs.

abs() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful