Solutions/ranran2121_solutions.js
//Write a function add that is generalized for any amount of arguments
Write a function add that is generalized for any amount of arguments
Write a function add that is generalized for any amount of arguments
function add(...nums) {
  let sum = nums[0];
  for (let i = 1; i < nums.length; i++) {
    sum += nums[i];
  }
  return sum;
}
function add ( ... nums ) { let sum = nums [ 0 ] ; for ( let i = 1 ; i < nums . length ; i ++ ) { sum += nums [ i ] ; } return sum ; }
Write a function add that is generalized for any amount of arguments
Write a function add that is generalized for any amount of arguments