From 5bcd0980815445df8b79880ef370d147d885b06c Mon Sep 17 00:00:00 2001 From: Saqib Saghir Date: Tue, 16 Oct 2018 12:54:26 +0300 Subject: [PATCH] chore: minor updat --- snippets_archive/squareSum.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/snippets_archive/squareSum.md b/snippets_archive/squareSum.md index 3ae951334..b130d5d35 100644 --- a/snippets_archive/squareSum.md +++ b/snippets_archive/squareSum.md @@ -6,10 +6,9 @@ Use `Array.prototype.reduce()` to iterate over numbers and to declare an accumul Use `Math.pow()` to calculate power of each number and add all numbers into acculmulator. ```js -const squareSum = (arr) => arr.reduce((squareSum, number) => - squareSum + Math.pow(number, 2), 0); +const squareSum = (...arr) => arr.reduce((squareSum, number) => squareSum + Math.pow(number, 2), 0); ``` ```js -squareSum([1, 2, 2]); // 9 +squareSum(1, 2, 2); // 9 ``` \ No newline at end of file