JSFiddle - React, Tailwind, and code Playground

by Horia-Adrian Ionescu

JavaScript

/* complete this function such that all arguments to this function will be passed, could be one argument, could be 6 */

function sum() {
  var sum = 0;
  for(var i = 0; i < arguments.length;i++){
    sum += arguments[i];
  }
  console.log(sum);
  return sum;
}

sum(1, 2, 3) // should be six;