Skip to content

Instantly share code, notes, and snippets.

@ggteixeira
Last active August 6, 2021 21:53
Show Gist options
  • Save ggteixeira/59d01a344aa920f160d630d110a21f74 to your computer and use it in GitHub Desktop.
Save ggteixeira/59d01a344aa920f160d630d110a21f74 to your computer and use it in GitHub Desktop.
filterBy() function
// Criar um filtro por chave e valor sem usar a função filter
function filterBy(key, value, array) {
const filteredList = [];
array.map((carro) => {
if (!!key || !!value) {
if (carro[key] == value) {
filteredList.push(carro);
}
}
});
return filteredList;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment