Need help fixing function


I am trying to figure out what I did wrong with the function below. The error message is:

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

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


there is a crucial word in this sentence: return, to return something, use the return keywrod


Thank you for the quick reply!


so what do they want you to return then? i can get the console to say the correct sentence only with the return its not working anymore. can you show me the correct script?



console.log("Hi, I am" + " " + name);

should be returned, but is currently logged to the console instead.

return literally means the function is handing you something back, this doesn't have to get logged to the console. we can store the returned result:

example = function(){
   return "hello world"
x = example()

and then log the stored result to the console:


or if you don't want to store the returned result, you can call console.log directly on the function call


I have looked at this for help and am still confused. My code is:

var nameString = function (name) {
return("Hi, I am" + " " + name);


Where am I going wrong?


Fraser should be a string. Names are often represented as strings.


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