Last active
February 27, 2016 03:34
-
-
Save ptkato/8dc826739d4038e3bff2 to your computer and use it in GitHub Desktop.
A thing.
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
alunos = [{nome:"Nilmar",notas:[2.5,6,6]},{nome:"Gustavo",notas:[6,4.5,7]},{nome:"Alexandre",notas:[10,10,0]},{nome:"Lionel Messi",notas:[5.9,5.9,5.9]}] | |
aprovados = alunos.filter(function(x) { | |
return (x.notas.sort(function(a, b) { | |
return a - b; | |
}).splice(0, 2).reduce(function(y, z) { | |
return y + z; | |
}) / 2) >= 6; | |
}); | |
console.log(aprovados); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment