Functions recap: string won't show up in the console


#1

Hey!

I'm wondering why this doesn't work. Codeacademy says "way to go!", so it should be correct, but in the console is just:

"[Function: nameString]"

May someone please tell me why this is happening?

https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/2/3?curriculum_id=506324b3a7dffd00020bf661

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


#2

nameString("Bla");
console.log(nameString);

I see what you were doing and it makes sense but it wont work.
instead of these two lines you would need to give namestring a value when you call it like this

console.log(nameString("Bla"));


#3

I see! Thank you for your response! Maybe Codeacademy should mark my code as false then...


#4

possibly. the reason it still passed is because you still met the instructions requirements, but you were using a different method that didn't give the same result so you didn't actually log what you wanted to. I hope that worked for you though and that you enjoy the course! :slight_smile:


#5

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