Skip to content
Related Articles

Related Articles

Improve Article

Lodash _.add() Method

  • Last Updated : 01 Sep, 2020

The _.add() method is used to add two numbers.

Syntax:

_.add(augend, addend)

Parameters: This method accepts two parameters as mentioned above and described below:

  • augend: This parameter holds the first number in addition.
  • addend: This parameter holds the second number in addition.

Return Value: This method returns the result of adding two numbers.

Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library into the file.



Javascript




// Requiring the lodash library  
const _ = require("lodash"); 
   
// Use of _.add() method 
let gfg = _.add(12, 38);
         
// Printing the output  
console.log(gfg)

Output:

50

Example 2:  

Javascript




// Requiring the lodash library  
const _ = require("lodash"); 
   
// Use of _.add() method 
let gfg = _.add(248, 723);
         
// Printing the output  
console.log(gfg)

 Output:

971
My Personal Notes arrow_drop_up
Recommended Articles
Page :