Confused on "Functions recap"


#1

Name: "Functions recap"

I am not sure if I fully understand this...

Code:

var nameString = function nameString(name) {
    console.log("Hi, I am" + " " + name);
};

nameString();

Output:

Hi, I am undefined
Hi, I am Susie

Error:

Oops, try again. Hmm, it looks like your nameString()
function doesn't return 'Hi, I am Susie' for the name Susie.


#2

For our purposes (and throughout this course) we only name a declared function, not a function expression.

var nameString = function (name) {

There may simply be no error message other than the one given.

This is the result of calling the function with no argument. name is undefined in that instance.

nameString("Wee Gillis");

#3

Solved


#5

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