How To Capitalize The First Letter Of A String In JavaScript

How To Capitalize The First Letter Of A String In JavaScript

In this Post We Will Explain About is How To Capitalize The First Letter Of A String In JavaScript With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to javascript capitalize first letter of each word Example

In this post we will show you Best way to implement How to Capitalize the First Letter of a String in JavaScript, hear for How do I make the first letter of a string uppercase in JavaScript with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Capitalizing first letter of each word in string – JavaScript

Here is a simple and quick source code below for the using JavaScript version of like as a ucfirst Example. This source code below will allow We to First later capitalize the first letter of a some string using JavaScript Example.

function first_ulater(mystring) 
{
    return mystring.charAt(0).toUpperCase() + mystring.slice(1);
}

capitalize first letter javascript

This simple source code below will use the JavaScript function charAt to get the simple only one character at a certain in index.

var firstLetter = mystring.charAt(0);

javascript capitalize first letter

And then we can use the uppercase simple function in JavaScript to set this mystring to be in first later capitals.

var uppercaseFirstLetter = mystring.charAt(0).toUpperCase();

javascript capitalize first letter of string

And Then we can add the simple rest of the mystring on to this first capital letter by using the some other way used to function slice() which will some allow us to as well as get the rest of the mystring and some remove the first letter.

var stringWithoutFirstLetter = mystring.slice(1)

uppercase first letter javascript

adding this so we get the simple JavaScript function ucfirst() alternative way.

function first_ulater(mystring) 
{
    return mystring.charAt(0).toUpperCase() + mystring.slice(1);
}

Example

I hope you have Got What is JAVASCRIPT: UPPERCASE FIRST LETTER IN A STRING And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Leave a Comment