JavaScript Capitalize First Letter of each sentence

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 :  Angular Authentication API PHP MySQLi

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:

E-junkie: Sell digital downloads online

E-junkie Provides a Copy-paste buy-now, and cart buttons for selling downloads, codes and tangible products on any website, blog, social media, email and messenger!

Also see:

  1. The Top 10+ Best Webinar Software Platforms For 2020-2021
  2. Build Your Future Godaddy Careers And Jobs
  3. Introduction To Web Hosting Services

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 :  CCAvenue Payment Gateway Integration in PHP


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