koder
1
Hello,
I am trying to execute the code, but the output itself showing NaN instead of the sum of numbers.
<script>
function addition(){
var sum =0;
for(i=0; i<=arguments.length; i++){
sum += arguments[i];
}
return sum;
}
alert(addition(1,2,3));
</script>
1 Like
PVgr
2
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
koder
3
Yeah It’s working, Thank You PVgr.
system
Closed
4
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.