Ramda’s R.product() takes a list of numbers and multiplies them all together. The official docs sample is R.product([2, 4, 6, 8, 100, 1]) → 38400. Added in v0.1.0. See also R.reduce.
Internally Ramda reduces with R.multiply starting from 1. That is why an empty list is 1, a one-item list returns that item, and a single 0 anywhere makes the whole product 0.
Syntax
Call R.product. Start with this line.
Ramda
R.product(list)
Call
What it does
R.product(list)
Primary signature.
R.product(...)
Call the math helper.
Prefer import { product } from "ramda" when you want a named import.
Library declarations
Ramda
R.product(list)
Parameters
Parameter
Description
list
Required. an array of numbers. Ramda multiplies every item together.
Return Value
Return Value
Description
*
Returns a Number: the product of all items.
Ramda Examples
📚 Getting Started
The official 38400 sample, then the reduce equivalent.
Multiplication by zero is always zero, so one 0 short-circuits the whole product. An odd count of negatives makes the product negative: 2 × -3 × 4 is -24.
Example 4 — Product of an Object Field
Pluck a numeric property, then multiply the resulting list.
Reduce-with-multiply starts at 1, so no items leaves 1. Reduce-with-add starts at 0. R.mean divides by length, so an empty list is 0 / 0 → NaN.
Compatibility
Browser Support
R.product() is plain JavaScript multiplication over a list — it runs anywhere Ramda loads: every modern browser plus Node.js. Logos use the shared browser-image-sprite.png sprite from this project.
✓ Ramda 0.1.0+ · Any JS runtime
Ramda.js R.product()
Load Ramda via CDN or npm, then call R.product(list). Because it only multiplies numbers, behavior is identical across engines.
100%With Ramda loaded
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
R.product()Universal
Bottom line: Safe in any project that includes Ramda. Use a CDN build such as ramda.min.js in the browser or install ramda from npm for Node.
Frequently Asked Questions
R.product(list) multiplies together every number in a list and returns that single product. It is Ramda's unary list-product helper, so you can pass it to R.pipe or R.pluck pipelines without writing a lambda.
R.product([2, 4, 6, 8, 100, 1]) returns 38400. That is the sample on ramdajs.com/docs/#product. Added in v0.1.0. See also R.reduce.
Yes. It has arity 1 and is automatically curried. Call R.product([2, 4, 6]) for a number. Calling R.product() with no argument returns a function that waits for the list.
R.product([]) returns 1 — the multiplicative identity. Internally it is R.reduce(R.multiply, 1, list), and reducing with no items leaves the starter value 1. Contrast with R.sum([]) which is 0, and R.mean([]) which is NaN.
R.multiply(a, b) takes two numbers. R.product(list) multiplies every item in an array. R.product([2, 3, 4]) is the same as R.reduce(R.multiply, 1, [2, 3, 4]).
No. R.product is a stable Ramda math helper from v0.1.0. It is not deprecated, experimental, or non-standard.