I'm stuck on 04/5 "How does a function work?"


#1

var foodDemand = function("food") {
console.log("I want to eat" + " " + food);
};
foodDemand("apples")

---I type the exact same thing above, But it gives me syntax error.
I understand how a function works and I think my code is correct but It gives me syntax error everytime I type that.


#2

Remove quotation marks " " around your paramter food here,


#3

Ah, I can't believe I was making a mistake there. Thanks for your help. :smile:


#4

You're welcome :slight_smile:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.