Javasript learning "functions recap" lets you pass with incorrect code


#1


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


Section will accept code that is incorrect. I wrote this incorrect code and it accepts it.

Incorrect code:

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

This prints "[Function]" on the console.


#2

The lesson checker does not examine our code, or our test statements. It uses its own test argument, "Suzie". As long as the return value is what is expected, then the lesson will pass. The function is correct.

Because that what nameString is, a function. Just passing the name of the function as an argument does not invoke it.


#3

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