PART 1 : Theory
-
The Math object in JavaScript is a built-in object that provides mathematical constants and functions. It is not a function object and cannot be used as a constructor.
-
No, the Math object is not a constructor. You cannot create an instance of it using new Math() — it is a static object.
-
Math.round() Rounds a number to the nearest integer.
Math.ceil() Rounds a number up to the next largest integer (towards positive infinity).
Math.floor() Rounds a number down to the next smallest integer (towards negative infinity).
-
Math.random() generates a pseudo-random floating-point number between 0 (inclusive) and 1 (exclusive). It does not include 1.
-
It can return values in the range: 0 ≤ value < 1
Part 2
-
Break task down into components
-
Identify assumptions
-
Look for a pattern or connection