How to lowercase a string in JavaScript?

If you want to easily capitalize a string in JavaScript to uppercase, you can use this simple snippet of code:

var str = "Hello World!";
var newStr = str.toLowerCase();

The result will be:

"hello world!"

You can also capitalize only the first letter of a string or uppercase the whole string.

LEAVE A REPLY

Please enter your comment!
Please enter your name here