Computes the product of factors given an array of factors.
This method runs in linear time, or O(n), where n
is equal to the length of the factors array.
In mathematics, it is formally written using the Greek
Capital Pi (Π) notation.
If there are zero factors, it will return the empty product
(also known as the nullary product and vacuous product),
which is equal 1 per the multiplicative identity.
Parameters
factors: number[]
An array of factors
lambda: ((n) => number) = ...
A single-parameter function for mutating each number
Computes the product of factors given an array of factors.
O(n)
, wheren
is equal to the length of thefactors
array.