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.
// 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.
// Requiring the lodash library
const _ = require("lodash");
// Given string
let str = "Hello Geeks!";
// Use of _.upperCase() method
console.log(_.upperCase(str));
Output:
'HELLO GEEKS'