Home > front end >  All bosses: arrays, averaging, in several ways, finally the results returned to NAN, and what the so
All bosses: arrays, averaging, in several ways, finally the results returned to NAN, and what the so

Time:09-26

 
Var arr=[4000500, 0140, 00900];
Var getAvg=function (array) {
Var len=array. Lenght;
Var sum=0;
for(var i=0; iThe sum +=array [I];
}
Return the sum/len;
}
The console. The log (getAvg (arr));

CodePudding user response:

length

CodePudding user response:

The console should be an error, don't look at the error message

CodePudding user response:

Var len=array. Lenght; Pay attention to spelling: length

CodePudding user response:

Write the wrong length

CodePudding user response:

Just inside the double post just to see you Chou Chou array sum problem