The Date object
Hey ,
I'm thrilled to help you learn JavaScript. Unfortunately, you've landed on a page where you cannot access with your current purchase.
Please upgrade (use this link) access this content.
I'm super eager to help you learn more!
Hey ,
I'm thrilled to help you learn JavaScript. Unfortunately, you've landed on a page where you cannot access with your current purchase.
Please upgrade (use this link) access this content.
I'm super eager to help you learn more!
What’s the date today?
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:
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.