Dont understand 11


#1


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("Kuma")
console.log(nameString)

i already did the code, and this outcome gives me [function = nameString]

and according to code academy it was right, since i called and printed what they told me, i assume what they actually wanted me to do was:

console.log (nameString("Kuma"))

what i dont get is, whats the difference between just calling the function and using the console.log to print it? both outcomes are exactly the same either

nameString("Kuma")
//and//
console.log(nameString("Kuma"))

#2

Take away this:

and your fine


#3

u really didnt read the post... thats not the problem, and doing so would give me a fail on the lesson


#4

The difference is...

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

is passing your name into the function called nameString and console.log is printing out the result of the function you are runninig.

and this...

console.log(nameString("Kuma"))

is not running the function it is printing out that nameString is a function and does not recognize your name parameter.

I hope this answers your question?!


#5

You didn't pass nameString a parameter here so console.log just prints what nameString is.


#6

Yes @netjumper28973 u are right I was going to post that in just a second after that but I needed to do something so I was not able to finish. @jayvin took my post!!(No offence @jayvin)


#7

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