Skip to content

Instantly share code, notes, and snippets.

@suissa
Created February 22, 2020 03:55
Show Gist options
  • Save suissa/60356c2d4268d61842151f11f50e5990 to your computer and use it in GitHub Desktop.
Save suissa/60356c2d4268d61842151f11f50e5990 to your computer and use it in GitHub Desktop.
Demonstração de como criar operações básicas de matemática usando Arrays - divisão - refatorando
const tamanhoDa = (lista) => lista.length
const dividir = (x, y, passos = 0, total = 0) => {
const lista = crieUmaListaDeTamanho(x).ePreenchaCom(y)
const listaFinal = lista.filter(n => {
total = total + n
return total <= x
})
return tamanhoDa(listaFinal)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment