Created
June 13, 2019 20:33
-
-
Save pedro-surf/827dc605a2d1bc465e714077c3097650 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
func1 = (myObjArray) => { | |
myObjArray.sort((a,b) => { return a.ranking - b.ranking; }); | |
}; | |
func2 = (myObjArray) => { | |
let acc = 0; | |
let len = myObjArray.length; | |
for(let i=0; i<len; i++) { | |
acc = acc + myObjArray[i].ranking; | |
} | |
return acc / len; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment