Explore your training options in 10 minutes



JavaScript: Capitalize First Letter of Each Word in a String

Comments (1)
  1. Avatar Dmitry says:

    Hey, nice article, there is a small type though… In the 3rd method it should be square brackets:

    let regex = /[^|\s]\S/g

    otherwise each word after the space begins with a space 😉

Leave a Reply

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

Many careers in tech pay over $100,000 per year. With help from Career Karma, you can find a training program that meets your needs and will set you up for a long-term, well-paid career in tech.

Career Karma

Find the right bootcamp for you

By continuing you agree to our Terms of Service and Privacy Policy, and you consent to receive offers and opportunities from Career Karma by telephone, text message, and email.

A person sitting on a dark green chair with a laptop on their knee