JS Built-ins
← String146 / 195
StringString.prototype.toLocaleUpperCasebeginner

String.prototype.toLocaleUpperCase() β€” basic ASCII uppercase

πŸ“– Usage Example
'hello'.toLocaleUpperCase()   // β†’ 'HELLO'
'world'.toLocaleUpperCase()   // β†’ 'WORLD'
'abc123'.toLocaleUpperCase()  // β†’ 'ABC123'

Use toLocaleUpperCase() to convert a string to uppercase using the locale-specific rules of the host environment.

String.prototype.toLocaleUpperCase()

str.toLocaleUpperCase() converts a string to uppercase using the host locale's rules. For ASCII strings, the result is deterministic.

Challenge: Implement localeUpper(str) that converts the string to uppercase.

localeUpper('hello') // β†’ 'HELLO'
πŸ’‘ Hints (1)
  • β€’ For ASCII strings, `toLocaleUpperCase()` behaves identically to `toUpperCase()`.