Tying it all together


#1

This is my code for it you have to debug on line 9 I debugged it from
this
greeting var func{name}(console.log(name)))}
to this
greeting var function (name) {
(console.log(name)}


#2

Variable declaration always begins with var:

var greeting

We then proceed to define the variable with an assignment:

var greeting = function () {};

Next we insert the formal parameter:

var greeting = function (name) {};

Now we can write the code into the function body:

var greeting = function (name) {
    console.log(name);
};

Now compare this to the given and study the brackets. See the differences?


#3

Ok I did this

var greeting = function (name) {
console.log(name);
};
name("Felix")

This was the error I got

Oops, try again. Your code doesn't look quite right. Feel free to peek back at earlier exercises if you need a syntax refresher!

I looked back and noting :frowning:


#4

While this looks like a function call expression, it calls upon an undefined function, name(). That is the variable in the parameter that takes the argument, 'Felix'. Use the function name in the call:

greeting("Felix");

#5

Oh I get it know thx <3


#6

And how are you a codeacademy Moderator