Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created April 13, 2022 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/b8b5d82a420f95dc1c3df69b9c9df81e to your computer and use it in GitHub Desktop.
Save codecademydev/b8b5d82a420f95dc1c3df69b9c9df81e to your computer and use it in GitHub Desktop.
Codecademy export
const veggies = ['broccoli', 'spinach', 'cauliflower', 'broccoflower'];
const politelyDecline = (veg) => {
console.log('No ' + veg + ' please. I will have pizza with extra cheese.');
}
// Write your code here:
const declineEverything = arr1 => {
arr1.forEach(politelyDecline);
}
const acceptEverything = arr2 => {
for (let j in arr2) {
console.log(`Ok, I guess I will eat some ${arr2[j]}.`)
}
}
politelyDecline(veggies)
acceptEverything(veggies)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment