Home » How To Capitalize The First Letter Of A String In JavaScript

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!.

Read Also:  Check all checkboxes in Angular js

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.

Read Also:  Remove Yellow BGBOX WordPress plugin

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.

Read Also:  javascript capitalize first letter of each word

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.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Angular check ngIf Array is Empty/isset/Null
  2. Read Also:  Laravel 5.7 Get Current Page URL path
  3. Read Also:  how to allow only 10 digit mobile number validation using javascript with jquery
  4. Read Also:  Angular 6 Searching Sorting Pagination Tutorials
  5. Read Also:  PHP Laravel Redirect with Query String Example
  6. Read Also:  Check Uncheck All Checkboxes using jQuery Selectors
  7. Read Also:  Vue IF Else Conditional Statement
  8. Read Also:  oops concepts in php with realtime examples (Classes and Objects)
  9. Read Also:  Angular check ngIf Array is Empty/isset/Null
  10. Read Also:  PHP Laravel Redirect with Query String Example

Leave a Comment

Your email address will not be published. Required fields are marked *