This guide is your complete reference to every Math property and method in JavaScript, all in one place — clean, concise, and ready to bookmark.
What is the Math Object?
The Math object in JavaScript lets you perform mathematical operations on numbers — everything from trigonometry and logarithms to rounding and random generation.
Math.sqrt(16); // 4
Math.PI; // 3.141592653589793
Math.random(); // 0.5739201837
Commonly Used Examples
Math.max(10, 20, 5); // → 20
Math.min(2, -3, 7); // → -3
Math.pow(2, 3); // → 8
Math.sign(-12); // → -1
Math.floor(4.9); // → 4
Math.random(); // → random value between 0–1
Want a random integer between 1 and 6 (like a dice roll)? Here’s your quick snippet:
Math.floor(Math.random() * 6) + 1;
More References
For a complete deep-dive on all JavaScript methods, syntax, and advanced examples, check the official MDN documentation or your favourite JS reference site.
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math)
Thank you.



Top comments (0)