Skip to content

Instantly share code, notes, and snippets.

@suarezafelipe
Created May 11, 2019 03:50
Show Gist options
  • Save suarezafelipe/e1d719c2a49ce5c07bbefd61e3f002d9 to your computer and use it in GitHub Desktop.
Save suarezafelipe/e1d719c2a49ce5c07bbefd61e3f002d9 to your computer and use it in GitHub Desktop.
// B: arreglo de beneficios
// C: arreglo de costos
const program = (B, C) => {
let costoBeneficio = C
.map(el, i) => {
razon: el / B[i],
indice: i
}
.sort(a, b) => {a.razon - b.razon}[0];
console.log(JSON.stringify(costoBeneficio))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment