I need help! Introduction to Functions in JavaScript


#1

Hi! I don't know what is wrong with the following code, but an error message keeps popping up: "SyntaxError: Unexpected identifier 'namestring'." Please help!

-DarkRytsk


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

#2

Lower and upper cases are important. You have your function name as nameString and not namestring (notice capital S -- camelCase). You also seem to be missing a closing bracket at the end.


#3

Thank you so much, however, that did not work. I still get varying error messages. Thanks anyhow!


#4

Your Eli is not a string. Strings are wrapped in quotation marks. You are also missing a closing bracket on the last line.


#5

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