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

String.prototype.toLocaleUpperCase() β€” empty string

πŸ“– 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() β€” Empty String

Calling toLocaleUpperCase() on an empty string returns an empty string.

Challenge: Implement safeLocaleUpper(str) and handle the empty string case.

safeLocaleUpper('') // β†’ ''
safeLocaleUpper('hi') // β†’ 'HI'
πŸ’‘ Hints (1)
  • β€’ `"".toLocaleUpperCase()` returns `""`.