Lodash _.subtract() Method
Last Updated :
03 Nov, 2023
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.
Javascript
const _ = require( "lodash" );
let gfg = _.subtract(50, 18);
console.log(gfg);
|
Output:
32
Example 2: In this example, we are subtracting one value from another value by using the lodash _.subtract() method.
Javascript
const _ = require( "lodash" );
let gfg = _.subtract(87, -98);
console.log(gfg);
|
Output:
185
Example 3: In this example, we are subtracting one value from another value by using the lodash _.subtract() method.
Javascript
const _ = require( "lodash" );
let gfg = _.subtract(-126, -53);
console.log(gfg);
|
Output:
-73
Share your thoughts in the comments
Please Login to comment...