how to convert whole strig in lowercase in js

JavaScript
var str = "Hello World!";
var res = str.toLowerCase();
Source

Also in JavaScript: