Computes the multiplicative aggregate of the values produced for each element in the source iterable.
The source iterable.
The product of all projected values.
Thrown when source is empty.
source is enumerated exactly once. Supply selector when elements are not already numeric.
const numbers = [1, 2, 3, 4, 5];const result = product(numbers);console.log(result); // 120const people = [ { name: 'Alice', age: 25 }, { name: 'Bob', age: 30 },];const ageProduct = product(people, p => p.age);console.log(ageProduct); // 750 Copy
const numbers = [1, 2, 3, 4, 5];const result = product(numbers);console.log(result); // 120const people = [ { name: 'Alice', age: 25 }, { name: 'Bob', age: 30 },];const ageProduct = product(people, p => p.age);console.log(ageProduct); // 750
Type of elements within the source iterable.
source
Optional projection that extracts the numeric value for each element. Defaults to interpreting the element itself as a number.
Computes the multiplicative aggregate of the values produced for each element in the source iterable.