Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

What is wrong here? I don't understand the instructions

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.

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

nameString("vinson");

5 Answers

Alejandro Hernandez
Alejandro Hernandez
7,629 Points

Try this:

var nameString = function (name) {

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

};

nameString('vinson');

thank you very much. it says it looks like I didnt print anything to the console. It still is not passing me

never mind i fixed it. Thank you very much.

Manar AL Saleh
PLUS
Manar AL Saleh
Courses Plus Student 9,603 Points

you can do it like this too, it will work

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

console.log(nameString('vinson'));