String.prototype.toLocaleUpperCasebeginner'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.
If the string is already uppercase, toLocaleUpperCase() returns an equal string.
Challenge: Implement ensureUpper(str) and verify it works on already-uppercase strings.
ensureUpper('HELLO') // β 'HELLO'