Open In App

Lodash _.toLower() Method

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:

Return Value:

This method returns the lowercase string.



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




// 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.




// Requiring the lodash library 
const _ = require("lodash");
 
//  Given string    
let str = "Hello Geeks!";
 
// Use of _.toLower() method
console.log(_.toLower(str));

Output:

'hello geeks!'
Article Tags :