Javascript Code Function Title Case String
Fast Simple Short Javascript Code to Title Case a string (capitalize the first letter of each word of a string)
Home
Short:
/*--------------------------------------------- fast efficient way to title case (upper case first letter of each word) of a string [str] -------------------------------------------- */ function titleCase(str) { return str.toLowerCase().split(" ") .reduce((s, c) => s + "" + (c.charAt(0).toUpperCase() + c.slice(1) + " "), "") .trim(); }
source code home
S
H
A
R
E
Facebook
Twitter
LinkdIn
Reddit
Blogger
π Ώing
Email π§
π Multiple
Facebook
Twitter
Linkdin
Reddit
Blogger
Ping
Email
Share β