My Code It Does Not Work. I want to Sum of Numbers that the user gives in arguments.
So I use here Argument Object but am unable to fetch what is the mistake.
// The Argument Object
function myFunc()
{
console.log("You give Total Numbers : "+arguments.length);
let sum = 0;
console.log("Sum is : ");
arguments.forEach(element => {
sum += element;
});
console.log(sum);
}
myFunc(10,20);
myFunc(10,20,30);
myFunc(10,20,30,40);
argumentsisn't exactly an array, it doesn't have the forEach function.