What if?
let ingredient
if (option === 1) {
ingredient = 'blueberry'
} else if (option === 2) {
ingredient = 'greenbean'
} else if (option === 3) {
ingredient = 'spinach'
} else if (option === 4) {
ingredient = 'broccoli'
} else {
ingredient = 'banana'
}
let ingredient
switch (option) {
case 1:
ingredient = 'blueberry'
break
case 2:
ingredient = 'greenbean'
break
case 3:
ingredient = 'spinach'
break
case 4:
ingredient = 'broccoli'
break
default:
ingredient = 'banana'
}
const INGREDIENTS = {
1: 'blueberry',
2: 'greenbean',
3: 'spinach',
4: 'broccoli',
}
const ingredient = INGREDIENTS[option] || 'banana'