Square(n) Sum

samuel Jo·2023년 6월 25일
0

codewars

목록 보기
24/47

DESCRIPTION:
Complete the square sum function so that it squares each number passed into it and then sums the results together.

For example, for [1, 2, 2] it should return 9 because

function squareSum(numbers){
    let sum=0;
  for(let i =0; i < numbers.length; i++){
  sum += numbers[i]**2;
  }
  return sum;
}

numbers[i]*numbers[i];로 해도 된다.

profile
step by step

0개의 댓글