JS Built-ins
Datenowbeginner

Date.now() β€” after year 2020

πŸ“– Usage Example
const ts = Date.now()  // e.g. 1705276800000
typeof ts  // β†’ 'number'

Use Date.now() to get the current time as milliseconds since the Unix epoch without creating a Date object.

Date.now()

Date.now() always returns a timestamp greater than any fixed date in the past.

Challenge: Verify that Date.now() is at least as large as the timestamp for Jan 1, 2020.

πŸ’‘ Hints (1)
  • β€’ Compare Date.now() with a fixed past timestamp using >=