How do I make the first letter of a string uppercase in JavaScript?
What is the best approach to capitalize words in a string?
What is the best approach to capitalize words in a string?
- Change all string to lowercase.
- The regex matches the first letter of each word within the given string and transforms only that letter to uppercase.
- \b matches a word boundary (the beginning or ending of word);
- \w matches the following meta-character [a-zA-Z0-9].
No comments