FAQ: Functions - Parameters and Arguments

Hey, @micro7957614922 welcome to the forums.

You cant do this because Cole is not a data type. You would need to make it a string because that is a data type.

Thanks! So, just to make sure I have it clear, template literals can be used to concatenate any known data type value as a string, but because Cole in this case has no data type yet it cannot be done as such?

1 Like

Yes because Cole but if you put 5 instead it would work because it is the number data type. You can view the entries for general data type and for JS data types.

Thanks, appreciated!

'Thank you for your purchase '+ name + ‘! We appreciate your business.’

The only thing I don’t quite grasp is why the + must be within the single quote.
In past exercises doing string concatenation the + were not inside the quotes.

Can someone explain why?

Hey, welcome to the forums!

I’m not quite sure what you mean here, would you mind clarifying please: the two strings themselves are in quotes, but the + (and the variable) are not :slight_smile:

That’s correct, it shouldn’t be

1 Like

AHHHH, i see what you mean now. I was looking at this wrong.
I was looking at this as if only name was in quotes. I see exactly what you mean now.

Thank you

1 Like

No problem, happy to help :slight_smile:

Thank you for asking this rishabhkaul, and thank you for your response victoria-dr! I did the same thing with trying to declare Cole as a variable in step 3, and I now understand what I did wrong here and how to fix it.

hey! quick question… for the example of passing an arguement/paramater through a function, my code looks like this:

function sayThanks(name) {
console.log(Thank you for your purchase, ${name}! We appreciate your business.);


in the example, it wants me to do it a different way, like: ’ + name +’ , and it wont let me progress. is my code correct? would i end up with dependency/scope issues down the line if i did it my way? idk why it says it’s “wrong”…


Welcome to the forums! Using string interpolation (the backticks) and concatenating it manually using + is effectively identical, it’s just the Codecademy marking algoritm being a little fussy :slight_smile: