What is the Math Object?
The Math object is a built-in JavaScript object that provides mathematical functions and constants. Think of it as a super-powered calculator!
Basic Example
⚡ javascript
1
2
3
4
// Math is always available, no setup needed!
console.log(Math.PI) // 3.141592653589793
console.log(Math.round(4.7)) // 5
console.log(Math.max(10, 20, 5)) // 20Key Points:
- Math is a built-in object (always available)
- All Math methods are used with Math. prefix
- Most methods work with numbers
- Great for games, calculations, and algorithms