• Skip to main content
  • Skip to primary sidebar

Founder at work

Master the skills to create and launch your next SaaS company

  • About Me
  • Reviews
  • Resources
  • Community
  • Contact
  • Lessons
  • Series
  • Search
  • Login

How to Capitalize the First Letter of a String in JavaScript

December 6, 2018 by Rick Hernandez 1 Comment

Here is a quick and practical guide on how to capitalize the first letter of a string using JavaScript plus I’m also including a function you can reuse.

The function CapitalFirstName is used to capitalize the first letter of the string but we go a step further by only capitalizing the first letter of the First name by checking if the name has spaces with the split() function and then grabbing the first value.

Then finally use the toUpperCase() function to capitalize the first letter and then slice the letter from the first string to obtain the value for the rest of the name. This is a quick handly function you can use for your next application.

Bests,

Rick H.

Rick Hernandez

I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related

Filed Under: JavaScript, JavaScript, Programming

Primary Sidebar

Learn How To Take Your Idea And Convert It Into An App From Scratch Even If You Have Never Written A Single Line Of Code.

  • How to Find Your Next Great App Idea
  • The Secret To Getting PAID To Build Your Own App
  • How To Create Your App (SaaS, Mobile, VR, AR, Game)
  • How To Monetize Your Apps
Learn More
4.82 Ratings

Copyright © 2025 · JSecademy Blog Theme on Genesis Framework · WordPress · Log in