JS Built-ins
← Date109 / 120
DatetoUTCStringbeginner

toUTCString() β€” result is truthy

πŸ“– Usage Example
const d = new Date('2024-01-15T00:00:00.000Z')
d.toUTCString()  // β†’ 'Mon, 15 Jan 2024 00:00:00 GMT'

Use toUTCString() to get a human-readable UTC date string in RFC 7231 format (e.g., used in HTTP headers).

Date.prototype.toUTCString()

The result is always a truthy non-empty string.

Challenge: Verify that new Date(0).toUTCString() is truthy.

πŸ’‘ Hints (1)
  • β€’ Non-empty strings are always truthy in JavaScript