Function help


#1

I cant find what I am doing wrong in this lesson
Help please?

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


#2

pssst...


#3

is this right?

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


#4

I'm still getting an error


#5

error says I didn't put quotes around the food I gave a command for


#6

Not quite, you only need the semicolon after your call statement.

var foodDemand = function(food) {
  console.log( "I want to eat " + food ); /*You can eliminate a bit of typing by including the space in the quotations*/
}

foodDemand("cheese");

Adding a semicolon after functions isn't really necessary, but you do need to add a semicolon after each individual statement, such as console.log(); and foodDemand();


#7

Im still getting an error

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


#8

"I want to eat "<-- add the space +...

The code is functional, but the codecademy platform will be looking for a specific output in order to check your answer. If you don't have the space it will throw up an error.


#9

Oops, try again. It looks like you didn't put quotes around the food you gave foodDemand!


#10

I still just get this error


#11

you spelled function wrong.


#12

YaY!!!!! wow! Well there you have it


#13

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