The browser storage localStorage is not available. Either your browser does not support it or you have disabled it or the maximum memory size is exceeded. Without localStorage your solutions will not be stored.
String: toUpperCase()
In addition to the
length property, strings have methods.
These are functions that are applied to the string. Like the length property,
these methods are appended with a point to the string or to a variable that contains a string.
The arguments enclosed in parentheses follow. Two of these string methods are the parameterless
methods toUpperCase and toLowerCase. They return the string in
uppercase or lowercase.
let town = 'Mthatha';
let output = town.toUpperCase();
output has the value 'MTHATHA'.
town still has the value 'Mthatha'.
output = town.toLowerCase();
Now output has the value 'mthatha'.Exercise
Write a function
Example:
toCase that takes a string and returns that string in
lowercase and uppercase with - as delimiter.Example:
toCase('Mthatha') should return 'mthatha-MTHATHA'.
+ Hint
function toCase(text) {
return ... + '-' + ...;
}
+ Solution
function toCase(text) {
return text.toLowerCase() + '-' + text.toUpperCase();
}
