uppercase letters js code example
Example 1: uppercase javascript
var str = "Hello World!";
var res = str.toUpperCase(); //HELLO WORLD!
Example 2: return first letter of string javascript in uppercase
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
console.log(capitalizeFirstLetter('foo')); // Foo
Example 3: javascript uppercase string
var str = "Hello World!";
var res = str.toUpperCase();