SyntaxFix
Write A Post
Hire A Developer
Questions
Here is the nice and cleaner version;
var str = ''; return str.replace(new RegExp('^'+str[0]+''), str[0].toUpperCase());
Results:
this is a test --> This is a test