I don't know what to do in "Introduction to Functions in JS"


#1

Whats wrong with my code?

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


#2

look:

# function declaration with food parameter
var foodDemand = function(food){
     console.log(food)
}

# function call with "pizza" argument
foodDemand("Pizza")
# function call with "hamburger" argument
foodDemand("Hamburger")

see how the arguments (pizza and hamburger) are copied into the function parameter? armed with this new knowledge, re-think the string printed


#3

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