I have been trying to solve this problem wherein any number of arguments can be passed and the function has to calculate the sum of all the values passed. Can you please help me understand what mistake I am making?
//complete the function
function Add(…nums){
let sum = 0;
for (let num of nums){
return sum += num;
}
}
console.log(Add(1,2,3));
console.log(Add(4,14,5,9,14));
console.log(Add(2,36));