Skip to content

Instantly share code, notes, and snippets.

@DeVoresyah
Created November 26, 2020 14:42
Show Gist options
  • Save DeVoresyah/c5897e2649c815917d8301ec97d06221 to your computer and use it in GitHub Desktop.
Save DeVoresyah/c5897e2649c815917d8301ec97d06221 to your computer and use it in GitHub Desktop.
Make A Coffee
const makeACoffee = (buyer, specs) => {
const coffees = []
buyer.map(person => {
const findSpec = specs.find(opt => person === opt.id)
coffees.push({
id: person,
coffee: `Cofee with ${findSpec.options}`
})
})
}
const buyer = ["A", "B", "C", "D"]
const specs = [{
id: "A",
options: "Black."
}, {
id: "B",
options: "Cream only."
}, {
id: "C",
options: "Sugar and cream."
}, {
id: "D",
options: "Sugar only."
}]
makeACoffee(buyer, specs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment