It keeps sending me an error when there is none


#1

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

It returns an error that says my code does not print "Hi, I am Susie" but when I run the code that's exactly what it prints "Hi, I am Susie" but I contiune to get the same message.

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

nameString("Susie");

#2

Instruction #3 says for the function to RETURN the message. You have console.logged it.

You need to console.log the call of the function which is the last line (nameString("Susie");). Not in the function.


#3

I tried just returning the message and then calling the function, It says you did not console.log a message. So I console.log it and it says I didn't return. Its printing exacting what the instructions say, its just keeps saying it wrong when it's not.

this print Susie just fine but complaints that there's no message being logged to the console.

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

The code below, returns the name as undefined, which is what makes me question where is Susie coming from? If I try to pass in my name it prints the message with my name and than returns an error because i didn't print Susie.

var nameString = function (name) {
return "Hi, I am" + " " + name;
};
nameString();
`
The instruction says nothing about Susie, you only find out that you have to print Susie when you run it. Where are these test case coming from?
sorry if this question is silly.


#4

You seem to have skipped over this.
console.log the call such as this:

console.log(randomFunctionCall(randomInput));

At the end where you have nameString();.


Actually, now that you ask about Susie (and it isn't a dumb question), Susie is a test case written by Codecademy in the back to test if you're code is working. The reason why it pops up is because they probably have
nameString('Susie') as the first test case and it didn't pass therefore, giving you that error message.

If you do console.log(nameString()); instead of just nameString();, you will pass and that's what the instruction says.


#5

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