Created
October 2, 2018 17:13
-
-
Save jrab66/e5878278da7bc312e77b018eb9de3ac6 to your computer and use it in GitHub Desktop.
ranking and averages
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
const AverageRanking = arr => { | |
const reducer = (total,currentValue) => total + currentValue | |
const sum = arr.reduce(reducer); | |
return sum; | |
} | |
const RankingAscending = arr => { | |
for(let i =0;i<arr.length;i++){ | |
for(let j =0;i<arr.length;j++){ | |
if(arr[i]>arr[j]){ | |
let tem = arr[i]; | |
arr[i]=arr[j]; | |
arr[j]=tem; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment