Answers for "how to convert first character of string to uppercase in js"

0

first letter string uppercase javascript

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

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

js first letter to uppercase

function capitalizeFirstLetter(name) {
    return name.replace(/^./, name[0].toUpperCase())
}
Posted by: Guest on April-21-2021

Code answers related to "how to convert first character of string to uppercase in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language