Answers for "string set each first character as uppercase"

0

return first letter of string javascript in uppercase

function capitalizeFirstLetter(string) {
  return string.charAt(0).toUpperCase() + string.slice(1);
}

console.log(capitalizeFirstLetter('foo')); // Foo
Posted by: Guest on August-31-2020
0

Checking if the first letter of the string is uppercase

if (this.state.name[0] >= 'A' && this.state.name[0] <= 'Z')
      this.setState({ name: "First letter is uppercase" })
    else
      this.setState({ name: "First letter is NOT uppercase" })
  }
Posted by: Guest on February-23-2022

Code answers related to "string set each first character as uppercase"

Code answers related to "Javascript"

Browse Popular Code Answers by Language