Open In App

Lodash _.upperCase() Method

Improve
Improve
Like Article
Like
Save
Share
Report

Lodash _.upperCase() method is used to convert the entire string to space-separated words, to upper case.

Syntax:

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

Parameters:

  • string: This parameter holds the string to convert.

Return Value:

This method returns the upper case string.

Example 1: In this example, we are making the first alphabet capital by the use of the lodash _.upperCase() method.

Javascript




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


Output:

'GEEKS FOR GEEKS'
'GEEKS FOR GEEKS'

Example 2: In this example, we are making the first alphabet capital by the use of the lodash _.upperCase() method.

Javascript




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


Output:

'HELLO GEEKS'

Last Updated : 03 Nov, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads