Lodash _.subtract() method is used to subtract two numbers.
Syntax:
_.subtract(minuend, subtrahend);Parameters:
- minuend: This parameter holds the first number in a subtraction.
- subtrahend: This parameter holds the second number in a subtraction.
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:
32Example 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:
185Example 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