JavaScript Capitalize First Letter of each sentence

Today, We want to share with you JavaScript Capitalize First Letter.In this post we will show you javascript capitalize, hear for javascript capitalize first letter of each word we will give you demo and example for implement.In this post, we will learn about how to capitalize the first letter in a string in javascript with an example.

JavaScript Capitalize First Letter

To Automatically write using JavaScript capitalize the first character of a your any string, We should to isolate mode the any string first character capitalize from the left of the message, and then 3 ways to concatenate it with some good Examples to the rest of the message.

READ :  Vuejs Parse Date Format Components

javascript capitalize first letter Example – 1

var small_str = 'how to capitalize the first letter in a string in javascript';
var capitalize_str = small_str.charAt(0).toUpperCase() + small_str.substr(1);

javascript capitalize Example – 2

Second Way, if We are comfortable with pure JavaScript regular expressions, We do simple things to change in capitalize first letter javascript Examples:

var capitalize_str = small_str.replace(/^\w/, function (chr) {
  return chr.toUpperCase();
});

capitalize first letter javascript Example – 3

Last Way, We can simple even take it one onther way to javascript capitalize by using more new syntax:

const capitalize_str = small_str.replace(/^\w/, c => c.toUpperCase());

jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

Read :

READ :  Capitalize First Letter JavaScript Example

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about JavaScript Capitalize First Letter of each sentence Example.I would like to have feedback on my Infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Add a Comment

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