Please help. meet the functions 4


#1

I am stuck and cant figure out why my code is not working. Any help would be appreciated.

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

please help me figure out what is wrong.
Thanks


#2

At that last line instead of the one you said do this since you cant call function twic

foodDemand("watermelon");

Hope this helped if this didnt reply please

Here is code:

// Write your foodDemand function below.
// Last hint: In your reusable block of code, end each line
// with a semicolon (;)

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

#3

console.log("I want to eat" +"" +word); <---------there is an extra/misplaced quotation mark.

console.log("I want to eat" " + " + word);


#4

? He didnt have a extra-misplaced quotation mark.

console.log("I want to eat" +"" +word);

#6

console.log("I want to eat" +"" +word); looks more like misplaced.

If they keep it as is then the + sign will show up.


#7

I dont see the Misplaced Word? I dont get what you are saying.


#8

not a word, the quotation marks are misplaced


#9

No thier not.. I dont see it.


#10

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

foodDemand("food")

Hope this helps!


#11
console.log("I want to eat" +" "+ "food");

Well the idea is that you use the paramter food here.
Make some test:

Version1:

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

foodDemand("food")

Version2:

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

foodDemand("icecream")

Version3:

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

foodDemand("pizza")

run them all and see the differences, what do you see and which one would you choose?


#12

what on earth is wrong with my one. For some reason it does not want to work.

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


#13

A function call is something like this: functionName([value]) ([] means optional not to be written literally). So in your case foodDemand("akple"); yours is more like overwriting the function with a new function with syntax errors.


#14

oh ok thank you mate


#15

what's wrong with this code. anyone pls!!

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

Everytime I am getting

Oops, try again. There was a problem with your syntax.