Skip to content

Instantly share code, notes, and snippets.

@JorgeMadson
Last active August 30, 2018 02:12
Show Gist options
  • Select an option

  • Save JorgeMadson/bca557b8ef11825642d7d241def60331 to your computer and use it in GitHub Desktop.

Select an option

Save JorgeMadson/bca557b8ef11825642d7d241def60331 to your computer and use it in GitHub Desktop.
Revisão Javascript Programação Funcional Array 2 - Filter
// Usando o array anterior
var prova = [ { aluno: 'Fogaça', nota: 9.5 },
// ...
];
var aprovados = prova.filter(function (item) {
return item.nota >= 8;
});
console.log(aprovados);
// Resultado:
// [ { aluno: 'Fogaça', nota: 9.5 },
// { aluno: 'Paola', nota: 10 },
// { aluno: 'Jacquin', nota: 8 },
// { aluno: 'Sofia', nota: 9 },
// { aluno: 'Rita', nota: 9.5 },
// { aluno: 'Vitória', nota: 10 } ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment