Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created February 6, 2020 08:43
Show Gist options
  • Save jasongorman/e0ad46dafe2ac406e54f1da70da6b1ca to your computer and use it in GitHub Desktop.
Save jasongorman/e0ad46dafe2ac406e54f1da70da6b1ca to your computer and use it in GitHub Desktop.
function buyCd(artist, title, catalogue) {
const cd = catalogue.find((cd => cd.artist == artist && cd.title == title));
return {...catalogue, [catalogue.indexOf(cd)] : {...cd, stock: cd.stock-1}};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment