Arguments Object Function


I am trying to execute the code, but the output itself showing NaN instead of the sum of numbers.

function addition(){
    var sum =0;
    for(i=0; i<=arguments.length; i++){
        sum += arguments[i];        
return sum;
1 Like

Change this for(i=0; i<=arguments.length; i++){ to this for(i=0; i<arguments.length; i++){ and it will be fine!

1 Like

Yeah It’s working, Thank You PVgr.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.