Is it a "Way to go!"? why is this correct!?


#1


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


I completed successfully this section but I can't find it why. It asks to print out My name, but the result is the printing of the function name itself, like this:

[Function: nameString]

Shouldn't it be the return order inside the function?
Of course, it will print out that element shown above, because of the console.log I added at the end. But why is this required? I delete it and it appears, as expected:

Hi, I am antonio

But if I delete that command, the exercise is wrong.

Thanks in advance!


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


#2

combine the two...

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

#3

yes! I figured it out some time ago! thank you!


#4

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