The _.toLower() method is used to convert the entire string to lower case. This function does not affect any of the special characters, digits, and the alphabets that are already in the lower case.
Syntax:
_.toLower( [string = ''])
Parameters: This method accepts a single parameter as mentioned above and described below:
- string: This parameter holds the string to convert.
Return Value: This method returns the lower case string.
Below examples illustrate the Lodash _.toLower() method in JavaScript:
Example 1:
Javascript
// Requiring the lodash library const _ = require( "lodash" ); // Use of _.toLower() method console.log(_.toLower( 'Geeks-For-Geeks' )); console.log(_.toLower( '#--GeeksForGeeks--#' )); |
Output:
'neveropen-for-neveropen' '#--neveropen--#'
Example 2:
Javascript
// Requiring the lodash library const _ = require( "lodash" ); // Given string let str = "Hello Geeks!" ; // Use of _.toLower() method console.log(_.toLower(str)); |
Output:
'hello neveropen!'