Skip to content

Instantly share code, notes, and snippets.

@jrab66
Created October 2, 2018 17:13
Show Gist options
  • Save jrab66/e5878278da7bc312e77b018eb9de3ac6 to your computer and use it in GitHub Desktop.
Save jrab66/e5878278da7bc312e77b018eb9de3ac6 to your computer and use it in GitHub Desktop.
ranking and averages
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