Lodash _.upperCase() Method

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('Beginner-For-Beginner'));
console.log(_.upperCase('#--w3wiki--#'));


Output:

'Beginner FOR Beginner'
'Beginner FOR Beginner'

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 Beginner!";
 
// Use of _.upperCase() method
console.log(_.upperCase(str));


Output:

'HELLO Beginner'

Contact Us