Lodash _.toLower() Method

Last Updated : 3 Nov, 2023

Lodash _.toLower() method is used to convert the entire string to lowercase. This function does not affect any of the special characters, digits, and alphabets that are already in the lowercase.

Syntax:

_.toLower( [string = '']);

Parameters:

  • string: This parameter holds the string to convert.

Return Value:

This method returns the lowercase string.

Example 1: In this example, we are converting the given value into all lowercase.

JavaScript
// Requiring the lodash library  
const _ = require("lodash");  
     
// Use of _.toLower() method 
console.log(_.toLower('Geeks-For-Geeks')); 
console.log(_.toLower('#--GeeksForGeeks--#')); 

Output:

'geeks-for-geeks'
'#--geeksforgeeks--#'

Example 2: In this example, we are converting the given value into all lowercase.

JavaScript
// Requiring the lodash library  
const _ = require("lodash");

//  Given string     
let str = "Hello Geeks!";

// Use of _.toLower() method 
console.log(_.toLower(str));

Output:

'hello geeks!'
Comment