JavaScript Code

How to convert string to lowercase using JavaScript?

Convert string to lowercase

Given a string, convert the string to lowercase using JavaScript.


To convert a given string to lowercase using JavaScript, call toLowerCase() method on the string. The method returns a new string with the characters in the given string converted to lowercase.


1. Given a string in str. Convert the string str to lowercase.

let str = 'Hello World';
let output = str.toLowerCase();