Skip to content

Instantly share code, notes, and snippets.

View To Upper Case on a String
var str = "hello world";
str = str.toLowerCase().replace(/\b[a-z]/g, function(letter) {
return letter.toUpperCase();
});
alert(str); //Displays "Hello World"