3. Function syntax

I don’t know what I’m doing wrong…

var greeting = function (“Elizabeth”) {
console.log(“Great to see you,” + " " + “Elizabeth”);}

Did you copy and paste your code?

I am pretty sure I did

Okay Great.I just had to make sure you got the exact code.

1 Like

In the () after the function keyword, when you use something inside of them it must be the name of a variable (called parameter). This will declare a local variable in the function by this name and you can assign values to this variable from outside of the function by passing values (called arguments) in the function call as you did here:


So better use e.g.:

var greeting = function (name) {

instead and use name inside of the function as an alias for your value. Thereby you could call the function with any name and you’ll always get an appropriate response not only for “Elizabeth”.

Okay I guess you can handle it then…

There’s no problem with that! We’re all here to help, you know? :wink:

hey do you guys know how to do this?

1 Like

can someone copy and paste code?

this function stuff is confusing


We can’t copy and paste the code thats against the rules but, admittedly this is one of the more easier topics of this course, if you’re having difficult with this I would recommend going back, and redoing things till you understand why you’re doing it.

Start by using and go from there.

var greeting = function(name) {

1 Like

Can someone tell me what’s wrong ?

var saludo = function(nombre) {
console.log(“Qué bueno verte” + “Silvia”);

you don’t put console.log in the curly brackets look at this

whoops just look at this
var greeting = function(name){console.log("Hello "+“name”);};

maybe its because your using spanish

Could you post the link to the spanish exercise? Maybe the tasks are a little different idk.
Also you’re not using the parameter nombre but instead use the hardcoded string “Silvia” same for you @tarikjaber your greeting function would print “Hello name” instead of “Hello YOURINPUT”.

Hi, I tried in Spanish and English, that´s my code, and it´s wrong, anybody can help me?

var saludo = function (name) {
console.log(“Qué bueno verte,” + " " + “Jose”);

Should be

console.log("Qué bueno verte," + " " + name);

This is the same for everybody else who had this problem.

Can anyone tell me the exact code , please? It is still not fixed

We’re not allowed to give you full code. Against CC policy.

1 Like