Constructor Quote by Eric Freeman
““Math is not a constructor, or even a function. It’s an object. As you know, Math is a built-in object that you can use to do things like get the value of pi (with Math.PI) or generate a random number (with Math.random). Think of Math as just like an object literal that has a bunch of useful properties and methods in it, built-in for you to use whenever you write JavaScript code. It just happens to have a capital first letter to let you know that it’s built-in to JavaScript.””
About This Quote
Source Book: Head First JavaScript Programming, 2014
Math in JavaScript is a built‑in object offering properties and methods, not a constructor function.
In simple terms: Math is an object with tools.
Use Math’s built‑in methods for calculations.
Themes
Mood
Type
When to use this quote
- calculating pi
- generating random numbers
- data analysis
- game development
Key Concepts
Questions to Reflect On
- When should you write your own function?
- What built‑in method simplifies your task?
Relying solely on Math may limit custom algorithms.