Lodash _.startCase() Method
The _.startCase() method is used to convert the string to start the case.
Syntax:
_.startCase( [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 start of the case string.
Below example illustrate the Lodash _.startCase() method in JavaScript:
Example 1:
Javascript
// Requiring the lodash library const _ = require( "lodash" ); // Use of _.startCase() method console.log(_.startCase( 'geeks for geeks' )); console.log(_.startCase( 'geeksforgeeks' )); console.log(_.startCase( '@#$%geeksforgeeks@#$%' )); |
Output:
'Geeks For Geeks' 'Geeksforgeeks' 'Geeksforgeeks'
Example 2:
Javascript
// Requiring the lodash library const _ = require( "lodash" ); // Use of _.startCase() method console.log(_.startCase( null )); console.log(_.startCase( '123456789' )); console.log(_.startCase( "gfg.Id" )); |
Output:
'' '123456789' 'Gfg Id'
Please Login to comment...