From 106b2c92b6a3c26431ea28c2ff7e1cd7df11948e Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Sat, 27 Jan 2018 12:10:33 +0000 Subject: [PATCH] Travis build: 1449 --- README.md | 2 +- docs/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6fe83767a..92f8a301f 100644 --- a/README.md +++ b/README.md @@ -3940,7 +3940,7 @@ unfold(f, 10); // [-10, -20, -30, -40, -50] ### average -Returns the average of an of two or more numbers. +Returns the average of two or more numbers. Use `Array.reduce()` to add each value to an accumulator, initialized with a value of `0`, divide by the `length` of the array. diff --git a/docs/index.html b/docs/index.html index 8a3a2b580..6df6bfcae 100644 --- a/docs/index.html +++ b/docs/index.html @@ -883,7 +883,7 @@ console.log< };
var f = n => (n > 50 ? false : [-n, n + 10]); unfold(f, 10); // [-10, -20, -30, -40, -50] -
Returns the average of an of two or more numbers.
Use Array.reduce() to add each value to an accumulator, initialized with a value of 0, divide by the length of the array.
const average = (...nums) => [...nums].reduce((acc, val) => acc + val, 0) / nums.length; +
Returns the average of two or more numbers.
Use Array.reduce() to add each value to an accumulator, initialized with a value of 0, divide by the length of the array.
const average = (...nums) => [...nums].reduce((acc, val) => acc + val, 0) / nums.length;
average(...[1, 2, 3]); // 2 average(1, 2, 3); // 2
Returns the average of an array, after mapping each element to a value using the provided function.
Use Array.map() to map each element to the value returned by fn, Array.reduce() to add each value to an accumulator, initialized with a value of 0, divide by the length of the array.
const averageBy = (arr, fn) =>