One of the most common operations performed on strings is the conversion of the characters in the string to lowercase. This is often done to ensure that string comparisons are case-insensitive, or to ensure that all strings in a particular dataset are in the same case.
To convert the characters in a string to lowercase, you can use the
let myString = "Welcome to GoLinux";
let lowercaseString = myString.toLowerCase();
console.log(lowercaseString); // "welcome to golinux"
welcome to golinux
In this example, the
toLowerCase method is called on the
myString string, and it returns a new string with all of the characters in lowercase. The result is then assigned to the
lowercaseString variable, and it is logged to the console.