How does a function work


I get the error “Oops, try again. It looks like you didn’t put quotes around the food you gave foodDemand!”

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



Hi @wannabewiz,

It’s better to provide a link so we can have a look on the exercise and learn to format code here.

You can write a function like this:

var testing = function (parameter) {
   //your code here
   // console.log(parameter);

So, replace food as the parameter and you need the keyword function in order to write a function.

Cheers :slight_smile:


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