Building Your Learning Module...
Getting things ready for you!
Find videos you like?
Save to resource drawer for future reference!
The Math object provides mathematical constants and functions. It's not a constructor - all properties and methods are static. No need to create an instance!
A built-in object with mathematical functions - like a calculator for your code!
No setup needed! Just use Math.method() - it's always available
Don't use "new Math()" - just call methods directly!
Math.round() - Round to nearestMath.ceil() - Round upMath.floor() - Round downMath.pow() - Power (2³ = 8)Math.sqrt() - Square rootMath.cbrt() - Cube rootMath.min() - Smallest valueMath.max() - Largest valueMath.abs() - Remove minus signMath.random() - Random 0-1Math.PI - 3.14159... (π)Math.E - 2.71828... (e)Math.SQRT2 - √2Math.LN2 - ln(2)Common mathematical operations
Exponential and root operations
Get absolute value and sign
Find minimum and maximum values
Sine, cosine, and tangent (in radians)
Built-in mathematical constants
Natural and base-10 logarithms
Math.round(price * 100) / 100Round to 2 decimal places
Math.sqrt(dx*dx + dy*dy)Calculate 2D distance
Math.round((value / total) * 100)Calculate percentage
Math.min(max, Math.max(min, value))Keep value between min and max
round() - nearest integerceil() - round upfloor() - round downtrunc() - remove decimalspow(x, y) - x to power ysqrt(x) - square rootcbrt(x) - cube rootmin(...) - smallest valuemax(...) - largest valueabs(x) - absolute valuesign(x) - -1, 0, or 1No need to create instance, use Math.method() directly
Math.PI, Math.E, etc. for precision
round, ceil, floor, trunc for different rounding needs
Optimized operations faster than manual calculations