0 day streak
javascript / beginner
Snippet

Converting Strings to Lowercase

The toLowerCase() method returns a new string with all characters converted to lowercase.

snippet.js
javascript
1
2
3
const input = 'HELLO WORLD';
const cleanInput = input.toLowerCase();
console.log(cleanInput);
nodejs
Breakdown
1
const cleanInput = input.toLowerCase();
Creates a lowercase version of the original string 'HELLO WORLD'.
2
console.log(cleanInput);
Prints 'hello world' to the console.