What is wrong with my code? Lesson 3/11


Hey CodeCademy community,
I cannot seem to find the issue with the following code on lesson 3/11:

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

After running this code, I get the following error:

SyntaxError: Unexpected identifier

Any ideas on what's wrong?


Hi try to remove the console.log


I tried that, but then I got the CodeCademy error saying:

Oops, try again. It looks like you didn't print anything to the console! Did you remember to console.log() the result of passing your name to the nameString() function?


I fixed it! I forgot to put parentheses around the material to be printed to the console.

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