Lodash _.multiply() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Math

Definition

Multiply two numbers. Part of Lodash Math since 4.7.0 (stable — not deprecated).

Pass the numbers or collection shown below. Check the return value before you chain another math helper.

Syntax

Call _.multiply. Start with this line.

Lodash
_.multiply(multiplier, multiplicand)
CallWhat it does
_.multiply(multiplier, multiplicand)Primary signature.
_.multiply(a, b)Run the math helper on numbers or a collection.

Prefer import multiply from "lodash/multiply" when you want a smaller bundle.

Library declarations
Lodash
_.multiply(multiplier, multiplicand)

Parameters

ParameterDescription
multiplierOptional. First number in the multiplication
multiplicandOptional. Second number in the multiplication

Return Value

Return ValueDescription
*Product, or short-circuit / default 1

Lodash Examples

Example 1 — Official Multiplication

Multiply two numbers and get the product.

Lodash
_.multiply(6, 4);
// → 24
Try It Yourself

How It Works

  1. Args. Multiplier 6, multiplicand 4.
  2. Op. Lodash runs native * after numeric coercion.
  3. Result. 24 — same as the official docs.
  4. Use. Handy in pipelines next to other _. math helpers.

Example 2 — Both undefined → 1

The default for multiply/divide is the multiplicative identity.

Lodash
_.multiply();
// → 1

_.multiply(undefined, undefined);
// → 1
Try It Yourself

How It Works

  1. Factory. createMathOperation(…, 1) sets the empty default.
  2. Identity. 1 is the multiplicative identity (like 0 for add).
  3. Not NaN. Empty call does not become NaN.
  4. Contrast. _.add() returns 0 for the same empty case.

Example 3 — One Argument Missing

The defined value is returned without multiplying.

Lodash
[
  _.multiply(6, undefined),
  _.multiply(undefined, 4)
];
// → [6, 4]
Try It Yourself

How It Works

  1. Short-circuit. If only one side is defined, Lodash returns it.
  2. No *. Multiplication never runs in that branch.
  3. null ≠ undefined. null is coerced (typically to 0) — different from omitting an arg.
  4. API tip. Prefer always passing two numbers in app code.

Example 4 — Numeric Strings Coerce

Unlike _.add, multiplication does not concatenate strings.

Lodash
console.log(_.multiply(10, "5")); // 50
console.log(_.add(10, "5"));      // "105"
Try It Yourself

How It Works

  1. multiply. * coerces "5" to 5 → 50.
  2. add. + concatenates when a string is present → "105".
  3. Invalid. _.multiply(10, "abc") → NaN.
  4. Tip. Still prefer explicit Number / _.toNumber for clarity.

Example 5 — multiply vs divide

Same factory family; opposite operations.

Lodash
[
  _.multiply(6, 4),
  _.divide(6, 4)
];
// → [24, 1.5]
Try It Yourself

How It Works

  1. multiply. Runs a * b.
  2. divide. Runs a / b.
  3. Default. Both return 1 when both args are undefined.
  4. Pick. Use the helper that matches the math you mean.

Browser & Runtime Support

_.multiply is a Lodash Math helper (available since 4.7.0, stable in 4.x). It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native engines already have *; Lodash provides a function form for composition and a 1 default when both args are undefined.

✓ Stable · Lodash 4.7.0+

_.multiply()

Available in [email protected] full builds and the lodash/multiply modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.

100% With Lodash 4.x
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
_.multiply Lodash 4.7.0+

Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import multiply from "lodash/multiply" for smaller builds. Equivalent to native * with Lodash’s undefined short-circuit and default 1.

Frequently Asked Questions

_.multiply(multiplier, multiplicand) returns the product of the two numbers. Official docs: _.multiply(6, 4) → 24.
_.multiply() with both undefined returns 1 — the multiplicative identity used by Lodash’s createMathOperation for multiply/divide.
The defined value is returned as-is. Example: _.multiply(6, undefined) → 6 and _.multiply(undefined, 4) → 4.
No. _.multiply(0.1, 0.2) matches native 0.1 * 0.2. Lodash does not correct IEEE-754 quirks.
_.add(10, '5') concatenates to '105'. _.multiply(10, '5') coerces and returns 50. Non-numeric strings still become NaN.
Use import multiply from "lodash/multiply" or require("lodash/multiply") for tree-shaking. Full build: import _ from "lodash" then _.multiply.

Next: _.round()

Round a number to a given precision.

_.round() tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful