It will iterate through each element of the provided values array and add the result of invoking iteratee function/property for each element to produce the desired sum, to then be divided by the values.length to produce the desired mean.
values
iteratee
sum
values.length
mean
The array to iterate over.
The function/property to get the value per element.
The mean value.
1.0.0
meanBy([1, 2, 3], number => number); // => 2 Copy
meanBy([1, 2, 3], number => number); // => 2
meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], ({ a }) => a); // => 2 Copy
meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], ({ a }) => a); // => 2
meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], "a"); // => 2 Copy
meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], "a"); // => 2
It will iterate through each element of the provided
valuesarray and add the result of invokingiterateefunction/property for each element to produce the desiredsum, to then be divided by thevalues.lengthto produce the desiredmean.