Sum of array elements with recursion in JavaScript

Let's now not display the array elements to the console, but find their sum:

javascriptfunction getSum(arr) {
  let sum = arr.shift();
  
  if (arr.length !== 0) {
    sum += getSum(arr);
  }
  
  return sum;
}

console.log(getSum([1, 2, 3]));
Задание 1

Given an array:

javascriptlet arr = [1, 2, 3, 4, 5];

Use recursion to find the sum of the squares of this array elements.