html
html
1
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
body {
}
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// custom function
String.prototype.replaceAt = function(index, char) {
return this.substr(0, index) + char + this.substr(index+char.length);
}
function titleCase(str) {
words = str.split(" ");
reqlist = [];
for (var i in words){
reqlist[i] = words[i].toLowerCase().replaceAt(0, words[i].charAt(0).toUpperCase());
}
return reqlist.join(" ");
}
alert(titleCase("I'm a little tea pot"));
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run