String.prototype.toUpperCasebeginner'hello world'.toUpperCase() // β 'HELLO WORLD'
'abc'.toUpperCase() // β 'ABC'
'xyz123'.toUpperCase() // β 'XYZ123'Use toUpperCase() to convert all alphabetical characters in a string to uppercase.
If all letters are already uppercase, toUpperCase() returns an equivalent string.
Challenge: Implement ensureUppercase(str) using toUpperCase.
ensureUppercase('HELLO') // β 'HELLO'