Functions Recap Error Message...Oops, try again


#1

var nameString = function (name )

{ return “Hi, I am” + name; };

console.log(nameString(“Susie”));

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

What am I doing wrong?


#2

you need a space between am and Susie.


#3

var nameString = function (name )
{
return “Hi, I am” + “”+ name

};

console.log(nameString(“Susie”));

I get the same error message with the space. I took away the space between Susie and am because another person had an issue on this thread with this problem and they took away the space, but I do not understand how they resolved the problem as they were not clear on the thread.


#4

have a look at the output

you are printing

Hi, I amSusie

but you have to print

Hi, I am Susie

Have a look at the instruction no.3 again.your returning statement doesn’t look quite right.


#5

Yeah, I noticed that, but I could not figure out what I was doing wrong. I just went back through the lesson and noticed that you have to put a space between the quotes in “Hi, I am” + " " + name. I did not have a space between those quotes so that is why I did not have a space between “am” and “Susie”.


#6

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