//Example – 1
function add1(){
if (arguments.length == 0){
document.write("NO Argument Passed!");
}
else{
let sum = 0;
for(let num in arguments){
sum += arguments[num];
}
document.write(sum);
}
}
add1(5,10);
In this example, I am getting the correct result.
//Example – 2 ( With Arrow Function)
let sum = () => {
if( arguments.length == 0){
document.write("NO Argument Passed!");
}
else{
let sum1 = 0;
for(let number in arguments){
sum1 += arguments[number];
}
document.write(sum1);
}
};
sum(10,20);
*Here I am getting an error in console “arguments is not defined”. Please tell me where I did Wrong.Thank you..!