Answers for "javascript unknown number of parameters"

0

javascript unknown number of parameters

function add (...numbers) {
  let sum = 0;
  for (let i = 0; i < numbers.length; i++) {
    sum += numbers[i]
  };
  console.log(sum);
};

add(2, 3);
add(5, 3, 7, 2);
Posted by: Guest on December-08-2020

Code answers related to "javascript unknown number of parameters"

Code answers related to "Javascript"

Browse Popular Code Answers by Language