You can tell the date physically if you have a calendar around you. You can also tell the time if you have a clock. In JavaScript, we can tell the date and time with the Date object.
Here’s what it looks like:
const date = new Date()
If you console.log date, you’ll get a log that tells you four things:
The day of the week (like Wednesday)
The date today (like Jan 23 2019)
The time now (like 17:21:13)
The timezone offset (like GMT+8000 Singapore Standard Time)
Wed Jan 23 2019 17:21:13 GMT+0800 (Singapore Standard Time)
There’s more things you can do with the Date object. Let’s go through them all in the next few lessons.