Introduction to Functions


#1


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


Oops, try again. Hmm, it looks like your nameString() function doesn't return 'Hi, I am Susie' for the name Susie.

My console.log is coming up twice. Can someone tell me why?


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


#2

your function logs this string to the console, not returning it


#3

When I use return instead of console.log i get this error...

Oops, try again. It looks like you didn't print anything to the console! Did you remember to console.log() the result of passing your name to the nameString() function?


#4

that is because you only partially did step 4 of the instructions.

console.log() should be used on the function call to log the returned result of the function


#5

im not sure if you understood what he was saying but he basically means that instead of
console.log("susie");
you are supposed to call the name of the function.
if you already had the answer then whatever.


#6

what do you mean?


#7

I was just trying to clarify it in case he didn't understand, I didn't mean to make it sound like you didn't do a good job at explaining but I noticed that he hadn't replied so I was just trying to simplify it for him. sorry if it came across that way.


#8

okay, but you replied to me?

and also, console.log("susie"); isn't anywhere in andersonkc code, so that is confusing


#9

oh sorry, my bad, I saw namestring("suzie") and thought it was a console.log and I just hit reply on the chat so I didn't mean it for you. just forget my first post. I messed up, sorry


#10

Makes sense. Thank you.


#11

Thank you for explaining.


#12

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