JS Built-ins
← String155 / 195
StringString.prototype.toLowerCasebeginner

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

πŸ“– Usage Example
'HELLO World'.toLowerCase()   // β†’ 'hello world'
'ABC'.toLowerCase()           // β†’ 'abc'
'XYZ123'.toLowerCase()        // β†’ 'xyz123'

Use toLowerCase() to convert all alphabetical characters in a string to lowercase.

String.prototype.toLowerCase() β€” Empty String

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

Challenge: Implement safeLower(str) using toLowerCase.

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