InterviewHubPRO
Section Overview
Q245

Question 245 of 521

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

47%
JavaScript Internals (521 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

What are the properties of the Intl object

Below are the list of properties available on the Intl object,

  1. Collator: These are the objects that enable language-sensitive string comparison.
  2. DateTimeFormat: These are the objects that enable language-sensitive date and time formatting.
  3. ListFormat: These are the objects that enable language-sensitive list formatting.
  4. NumberFormat: Objects that enable language-sensitive number formatting.
  5. PluralRules: Objects that enable plural-sensitive formatting and language-specific rules for plurals.
  6. RelativeTimeFormat: Objects that enable language-sensitive relative time formatting.

Practical Code Example

javascript
// Key Constructors on the Intl Namespace:
console.log(typeof Intl.Collator);       // String comparison for sorting
console.log(typeof Intl.DateTimeFormat); // Date/Time formatting
console.log(typeof Intl.NumberFormat);   // Currency and percent formatting
console.log(typeof Intl.PluralRules);    // Language-specific plural rules
console.log(typeof Intl.RelativeTimeFormat); // e.g., '3 days ago'