Date object provides date / calendar functions as shown below. The default output of the
Date() looks something like this:
Fri Aug 17 2018 18:16:34 GMT+0800 (Hong Kong Standard Time)
Take a look at the sample code below and see how the
Date object is used in the program.
The code above shows three examples of the use of Date object. The second and third example uses
setTimeInterval(), two advanced methods that will help you continuously run a function over a certain interval or to create your own timer tell the program when to run a certain function. We will not go in depth with the two methods, but feel free to research these two methods if you are interested as it could potentially help you in the future if you ever work with websites.