Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Arvin iuunhao
Added: Jun 18, 2018 8:32 AM
Views: 5
Tags: js
大写每个单词的首字母
  1. const capitalizeEveryWord = str => str.replace(/\b[a-z]/g, char => char.toUpperCase());
  2. // capitalizeEveryWord('hello world!') -> 'Hello World!'