4. how does a function work


#1

I made sure mines was to look just like hers and it says unexpected token.

// Write your foodDemand function below.
// Last hint: In your reusable block of code, end each line
// with a semicolon (:wink:
var foodDemand = function(food) { (console.log("I want to eat" + " " + food)

}

foodDemand ("pizza and ribs");
console.log (foodDemand)

Can you please help me with mine? I'm so confused. Thanks!


4 - How does a Function Work? Help please!
#2

you can remove this line:

console.log (foodDemand)

you already called the function in the line above, and the function will log the result to the console. as for the unexpected token:

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

you have a ( before console.log, i don't see why it should be there, remove it


#3

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