What am i doing wrong?


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

console.log (nameString ("Roman"));
//i am getting an undefined error what am i doing wrong?


i solved my own problem. you can't have return and a space between the code so it would be return"Hi, I am" + " " + name;
not return
"Hi, I am" + " " + name;

can someone please explain why this is?


I don't think it matters if there is the keyword return and the rest of it on the next line. Is that what you mean?


yeah that what i mean but it would say undefined error if i pressed enter then typed the rest on the next line.