Discussion: Dating with Math
Execute the code to understand the output and gain insights into random number generation in JavaScript.
We'll cover the following...
Verifying the output
Now, it’s time to execute the code and observe the output.
Press + to interact
const date = new Date;const x = date % 100;console.log(x);
The Date
object
In JavaScript, the Date
object represents a specific point in time. When we create a new instance of the Date
object using the new
keyword, it initializes with the current date and time.