Skip to content
Related Articles

Related Articles

Improve Article

Lodash _.toUpper() Method

  • Last Updated : 07 Sep, 2020

Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc.

The _.toUpper() method is used to convert the entire string to Upper case. This method does not affect any of the special characters, digits, and the alphabets that are already in the upper case.

Syntax:

_.toUpper( [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 upper case string.



Example 1:

Javascript




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

Output:

'GEEKS-FOR-GEEKS'
'#--GEEKSFORGEEKS--#'

Example 2:  

Javascript




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

Output:

'HELLO GEEKS!'
My Personal Notes arrow_drop_up
Recommended Articles
Page :