Do not understand what is wrong

I do not understand were and what is wrong
it says that I need to make myStr should be created using the const keyword.
But to me I did make myStr created using the const keyword.

Your code so far


// Example
var ourStr = "I come first. " + "I come second.";

// Only change code below this line

var myStr = "This is the start. " + "This is the end.";

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36

Challenge: Concatenating Strings with Plus Operator

Link to the challenge:

Part of being a dev is paying close attention to details.

But to me I did make myStr created using the const keyword.

On this line?

var myStr = "This is the start. " + "This is the end.";

I don’t see const anywhere in your code. I do see the var keyword.

Ah right right. I must have forgot to put the const @kevinSmith ! And where should I put the const keyword again?(I forgot It)

const is an alternative to var. var was the “old” way to do it. Now we have let and const. We use const when we know it will not have to be reassigned (changed in the case of a primitive, like this).

So, basically, in this case, don’t use var, use const. In general, don’t use var - use let or const.

Oh right. I now remember, thanks @kevinSmith !

I just passed It @kevinSmith! Thank you so much!!!

1 Like

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