JS Built-ins
← Date55 / 120
DategetSecondsintermediate

getSeconds() β€” after construction with full args

πŸ“– Usage Example
const d = new Date(2024, 0, 15, 12, 30, 45)
d.getSeconds()  // β†’ 45
// returns 0–59

Use getSeconds() to retrieve the seconds component (0–59) of a Date object in local time.

Date.prototype.getSeconds()

Using all 7 args, getSeconds() returns the correct value.

Challenge: Verify that new Date(2024, 0, 15, 12, 30, 45, 500).getSeconds() returns 45.

πŸ’‘ Hints (1)
  • β€’ All time components are independently set by the 7-arg constructor