Created
March 25, 2019 17:16
-
-
Save noximus/698d4ed45ce0ed508cc5b5a41ce172c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getAverageTestScore(scores) { | |
var total = 0; | |
for (var i = 0; i < scores.length; i++) { | |
total += scores[i]; | |
} | |
const avg = total / scores.length; | |
// const avg = scores.reduce((a, b) => a+b )/ scores.length; | |
return avg | |
} | |
let avg = getAverageTestScore([80, 100]); | |
console.log(avg, '<-- should be 90'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment