What am i missing #3


#1

// Below is the greeting function!
// See line 7
// We can join strings together using the plus sign (+)
// See the hint for more details about how this works.

var sayHello = function (sayHello) {
console.log("Great to see you," + " Dillon" + name);
};

// On line 11, call the greeting function!
function sayHello("Dillon");


#2

// Below is the greeting function!
// See line 7
// We can join strings together using the plus sign (+)
// See the hint for more details about how this works.

var sayHello = function (sayHello) {
console.log("Great to see you," + sayHello);
};

// On line 11, call the greeting function!
function sayHello("Dillon");

Here we have more than one Mistake:

First decide do you wanna use a parameter that is called name or sayHello

var sayHello = function (sayHello) {
    console.log("Great to see you," + " Dillon" + name);
};

Name is a good one so you should change your code like this:

var sayHello = function (name) {
    console.log("Great to see you, " + name);
};

Than you wanna call a function and dont want declare a second one:

// That works only like this 
sayHello("Dillon");

#3

it says i need to pass it a name


#4

Oops, try again. You did not call the greeting function. Pass it a name!


#5

Post please the instructions and than i can help you :smile:


#7

On line 11, call the greeting function and put in a name that you want the greeting function to include.
Press "Save & Submit Code" and see the function get into action! Saves you so much time.


#8

its actually asking you to create a function and name that function 'greeting'

once you have created your function and given the function the name - greeting you can then call that function named greeting

when you call the function it means it will display to you the message you created in your newly created function that you named 'greeting' directly in the console window.

Try this code out and see if it works for you (and if it does then amend it to help you answer your question in functions - i am learning functions too and just a couple of steps ahead myself so we are roughly going through the same learning curve.

// create a function named greeting
var greeting = function (sayHello)
{
console.log("Great to see you," + " " + sayHello);
};

// On line 11, call the greeting function!
greeting("lost in space");

You should get the following output in the black window console on the screen:

Output:

Great to see you, lost in space

These are the notes I have copied from the instructions page into my code as I am going along in the lesson just to help remind me what each aspect does and mainly to help me in what I am 'trying' to achieve...understand fundamentals of programming...grrr..functions! hehe

// Declare your function and call it foodDemand.
// The var keyword declares a named variable (foodDemand)

var foodDemand = function(food)

// Parameters go in the parentheses.
// The computer will look out for it in the code block.

{
// between the curly brackets { } enter the reusable
// block of code you want to repeat

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

// The entire function ends with a semi-colon (;).

};

// The semi-colon acts like a period in a sentence. It helps the computer know where there are stopping points in the code.

To complete the task change what has been entered inside the ( ) brackets (sayHello)

// create a function named greeting
var greeting = function (changedThisName)
{
console.log("Great to see you," + " " + changedThisName);
};

// On line 11, call the greeting function!
greeting("lost in space");

Output:

Great to see you, lost in space
// notice the message printed to the black console window is not changed!

whatever name is inside the ( ) brackets is also added into the console.log message
when you call the function:
greeting("lost in space");
the computer will read the function named greeting
and the name you assigned - the name you give it when you call the function ("lost in space")
will then be added into the message when the computer is instructed to print it out to the console window.

so you can change it round again and again if you like:

// create a function named greeting
var greeting = function (notAnotherName)
{
console.log("Functions, what a headache," + " " + notAnotherName);
};

// On line 11, call the greeting function!
greeting("totally dun my head in this has");

Output:

Functions, what a headache, totally dun my head in this has

// this time notice that the name inside the ( ) brackets changed again AND the output message is totally changed too when printed out in black console window ...

hope this has helped and makes a bit of sense..i am finding it frustrating too but trying to add a bit of humour in with the lesson whilst learning ...apologies if my humour is not akin to yours- just making learning a bit more fun ..or trying hehe..