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: trim()

The trim method removes whitespaces from both ends of a string.
let input = ' Rosa Parks ';
let name = input.trim();
name contains the string 'Rosa Parks'. Notice that input still contains the string ' Rosa Parks '.

Exercise

Write a function firstChar, which returns the first character that is not a space when a string is passed.

Example: firstChar(' Rosa Parks ') should return 'R'.
function firstChar(text) {
// Trim first.
// Then use the
// charAt method.
}
function firstChar(text) {
  let trimmedText = text.trim();
  return trimmedText.charAt(0);
}

loving