From 84e5d1012ca1ceb37c09152cbc61317136f933cc Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Tue, 16 Oct 2018 10:57:06 +0000 Subject: [PATCH] Travis build: 648 --- docs/archive.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/archive.html b/docs/archive.html index 73dc1a481..0d57c8d42 100644 --- a/docs/archive.html +++ b/docs/archive.html @@ -277,4 +277,6 @@ window.speechSynthesis.speak(msg); };
speechSynthesis('Hello, World'); // // plays the message +
Squares each number in an array and then sums the results together.
Use Array.prototype.reduce() in combination with Math.pow() to iterate over numbers and sum their squares into an accumulator.
const squareSum = (...args) => args.reduce((squareSum, number) => squareSum + Math.pow(number, 2), 0); +
squareSum(1, 2, 2); // 9