+ 15
[CHALLENGE] avg (average) function
Another simple challenge. Create avg function. Given input for example: arr = [1,2,3,4,5] Output: result = 3 (because it's average of whole arr list)
10 Respuestas
+ 10
function avg(list) {
var sum = pop = 0
while (list.length) {
sum += list.pop()*1
pop++
}
return sum/pop
}//avg
console.log(avg([1,2,3,4,5]))
+ 9
I didnt read it properly the first time 😉
https://code.sololearn.com/cH48c92x9O13/?ref=app
+ 6
https://code.sololearn.com/ccv5cCmP5KcZ/?ref=app
https://code.sololearn.com/cKZPQ8KNXI7M/?ref=app
https://code.sololearn.com/cRX6BWKxr9Sz/?ref=app
https://code.sololearn.com/c9q3jxoV01h8/?ref=app
+ 6
r8w9
I can submit your challenges in Lesson Factory like Assignment and get the bagde Creator
+ 4
+ 4
+ 1
https://code.sololearn.com/ck1X8rsr0C4S/?ref=app