Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 4x 49x 4x 46x 4x 52x | export function sortByWealth(userCommonsArray, returnArraySize = userCommonsArray.length){ return userCommonsArray.sort((a, b) => { return b.totalWealth - a.totalWealth; }).slice(0, returnArraySize); } export function sortByNumCows(userCommonsArray, returnArraySize = userCommonsArray.length){ return userCommonsArray.sort((a, b) => { return b.numOfCows - a.numOfCows; }).slice(0, returnArraySize); } export function sortByCowHealth(userCommonsArray, returnArraySize = userCommonsArray.length){ //sorts in decreasing order, so the comparison function returns a negative when the first parameter is larger return userCommonsArray.sort((a, b) => { return b.cowHealth - a.cowHealth; }).slice(0, returnArraySize); } |