Lodash _.multiply() Method

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

The _.multiply() method is used to multiply the two given numbers in the parameters and return the result.

Syntax:

_.multiply( multiplier, multiplicand )

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

  • multiplier: This parameter holds the first number in the multiplication.
  • multiplicand: This parameter holds the second number in the multiplication.

Return Value: This method returns the product of two numbers.



Example 1:

Javascript

filter_none

edit
close

play_arrow

link
brightness_4
code

// Requiring the lodash library  
const _ = require("lodash");  
    
// Use of _.multiply()  
// method 
let ans = _.multiply(15, 8); 
        
// Printing the output  
console.log(ans);

chevron_right


Output:

120

Example 2:  

Javascript

filter_none

edit
close

play_arrow

link
brightness_4
code

// Requiring the lodash library  
const _ = require("lodash");  
    
// Use of _.multiply()  
// method 
let ans = _.multiply(23, -9); 
        
// Printing the output  
console.log(ans);

chevron_right


Output:

-207

full-stack-img

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.