Skip to content

Instantly share code, notes, and snippets.

@ethanstenis
Created July 17, 2017 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethanstenis/94f3e3c1dd1a73c061df0733f411f68e to your computer and use it in GitHub Desktop.
Save ethanstenis/94f3e3c1dd1a73c061df0733f411f68e to your computer and use it in GitHub Desktop.
This is the solution to Codewars' KATA: Square(n)Sum
function squareSum(numbers){
var total = 0;
for(var i = 0; i < numbers.length; i++) {
total += numbers[i] * numbers[i];
}
return total;
@mahadnifsey
Copy link

I found that my solution using loops worked;
function squareSum(numbers) {
let sum = 0
for( let i = 0; i < numbers.length; i++) {
sum += numbers[i] **2
}
return sum
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment