When I enter my code, it says I did not call foodDemand


#1



Link to exercise:
https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/0/4?curriculum_id=506324b3a7dffd00020bf661#


I think I'm doing my code right, but the computer keeps telling me that I didn't call foodDemand.

My code:

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


#2

This post was flagged by the community and is temporarily hidden.


#3

I entered:

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

and it came up with a false positive. In the box it says:

ribs
I want to eat undefined


#5

it did return it, but it came before the sentence and made the word undefined appear.


#6

then I accidentally moved on to the next lesson trying to click the "save and run" button and did it like this:

// Nicely written function:
var calculate = function (number) {
var val = number * 10;
console.log(val);
};

// Badly written function with syntax errors!

var greeting = function (name){

console.log(name);
};

console.log (greeting())

and it came up with another false positive with two "undefined" in the box.


#8

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

foodDemand("ribs")

.....

make sure to give parameter for the foodDemand function which is food

and define that food parameter with any thing you like. in this case it is ribs


#9

yes, that makes sence. I think the problem in my code was the local and global variables.


#10