Skip to content

Instantly share code, notes, and snippets.

@Matthew-Troost
Created June 22, 2019 12:53
Show Gist options
  • Save Matthew-Troost/29d1078642aecf3a62a8f3616974948b to your computer and use it in GitHub Desktop.
Save Matthew-Troost/29d1078642aecf3a62a8f3616974948b to your computer and use it in GitHub Desktop.
Chaser Code Test
function orderByRanking(objArray) {
return objArray.sort((a,b) => (a.ranking > b.ranking) ? 1 : ((b.ranking > a.ranking) ? -1 : 0));
}
function avarageRanking(objArray){
return objArray.reduce((total, next) => total + next.ranking, 0) / objArray.length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment