JavaScript; Question 11; Working code, can't pass project


#1

The questions is

Write a function called nameString()
It should take name as a parameter.
The function returns a string equal to "Hi, I am" + " " + name.
\Call nameString() by passing it your name, and use console.log to print the output.

My code is:

var nameString = function (name) {
return "Hi, I am" + " " + name;
console.log(string.return); // here I get an error, but it works anyways.
};
nameString("Hans")

On the console I get:
"Hi, I am Hans"

But the website gives me this error:
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?


#2

While confusing since something does show up, the error message is accurate

You aren't doing that. You do not call console.log.


#3

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