Hi!
In the default params course I have given this answer, which is exactly what the teacher is telling us to do:
const foodFunction = (milk = 'milk', something = 'something') => {
if (milk) {
console.log(`I'm going to buy ${milk} from the grocery shop`)
} else {
console.log(`I'm going to buy ${something} from the grocery shop`)
}
}
foodFunction("something")
The question, please see the bolded texts:
/*
**** Challenge *****
Create a function that receives a **parameter of food**.
If your **parameter food** is going to have a value of **"milk"**
the function should print into the console the following:
"I'm going to buy **milk** from the grocery shop"
But if you dont pass a value to your parameter food, it should print
**"I'm going to buy something from the grocery shop"**
*/
The answer of the teacher was:
function foodShopping( food ) {
console.log(`I'm going to buy ${food} from the grocery shop`);
}
foodShopping("eggs");
I know there is no definite correct answer with coding but is my answer considered OK?