3. Function Syntax


#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(Johnny) {
console.log("Hello" + " " + "Johnny")
};

// On line 11, call the greeting function!
console.log("Hello" + " " + "Johnny");
sayHello ("Johnny");
I need help.


#2

Hey @dolphintail! First you want to have name as your parameter since you want to input any name, and output the name the user inputed so like this:

 var sayHello = function(name) {
console.log("Hello" + " " +name)
};

and finally to call it you do this:

sayHello(Johnny) without the quotation marks. You dont need the loging. Hope this helped!


#3

Thank you @amanuel2 Helped out a bunch!


#4

Almost but you want to call it with quotation marks because otherwise Johnny would be treated as an undefined variable:

sayHello("Johnny")