11. Function Recap


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


Is there anything wrong with this?


This should work
var nameString = function ( ) {

"Hi, I am" + " " + name;


Sry but no this should not work. the function call is inside of the fucntion and it is not returning anything. You're kind of cheating by using value at that should be returned on the last line of your code but that is not how this exercise was intended. Take @viperkatz's code as an example how it should look like. Or @viperkatz is there anything wrong with it? Do you get an error? Because from what I can see it should be ok.


@viperkatz, and @haxor789. This lesson requires a specific return from the function (E.G No spelling, grammatical, or otherwise incorrect punctuation or spacing errors.) In this case there's a missing space between the " , " comma, and the " I " in your return string. While it's not entirely necessary to add an ending semi-colon to the end of your return statement, I would suggest it to keep errors from forming in the future as it's good practice.

The only thing needed to be fixed is the following:

return "Hi, I am"+" "+name
//Insert space there


I am having the same trouble as the 1st usere here is my codes

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

with this one i get an error saying "john is not defined"

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

and with this one i get an error saying "missing ) after argument list"
Could you please help me?
Thanks in advance


You need to pass "John" to the function not John. "John" would be a string value, that by the use of onsole.log(nameString("John")), is assigned to name which leads to the output "Hi, I am John. Whereas John would be confused with the name of a variable and as this variable is neither declared nor defined you get the "john is not defined" error. Also never use a semicolon inside of a console.log after it would be ok but never inside. Also what is the difference between your two versions?


semi colon in the return .


Oh i see Excuse me i posted the same code twice due to a copy paste mistake.Thank you good sir ,now i know what to to .




this should work


Yes it was about the missing space between am and Rufus. Also please rather post code and error messages instead of screenshots as they might get auto flagged as spam if you use too many of them (multiple maybe commercial filehoster links ... :frowning: ). Also one can run the code then and for example spaces are harder to see in screenshots than in copyable text.


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



Name does not exist outside of the function so this probably throws an error. Rather print console.log(namestring("Maria")); and just delete the last line.


I dont know what is happening here...


try this

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


hope it will help you


You are missing semicolon after return


@arcsolver25702 Actually, you don't need semi colons after the return statement.

@boardslayer45069 Your real problem is that you're missing a space between "Hi" and "I". Remember, Codecademy is really picky with following directions.