Open In App

Lodash _.subtract() Method

Lodash _.subtract() method is used to subtract two numbers.

Syntax:

_.subtract(minuend, subtrahend);

Parameters:

Return Value:

This method returns the difference between two numbers.



Example 1: In this example, we are subtracting one value from another value by using the lodash _.subtract() method.




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

Output:



32

Example 2: In this example, we are subtracting one value from another value by using the lodash _.subtract() method.




// Requiring the lodash library 
const _ = require("lodash");
 
// Use of _.subtract() method
let gfg = _.subtract(87, -98);
 
// Printing the output 
console.log(gfg);

Output:

185

Example 3: In this example, we are subtracting one value from another value by using the lodash _.subtract() method.




// Requiring the lodash library 
const _ = require("lodash");
 
// Use of _.subtract() method
let gfg = _.subtract(-126, -53);
 
// Printing the output 
console.log(gfg);

Output:

-73

Article Tags :