Basic JavaScript - Concatenating Strings with the Plus Equals Operator

What am I doing wrong here?:

let myStr; = “This is the first sentence.”;
myStr; += “This is the second sentence.”;

let myStr;

Your browser information:

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

Challenge: Basic JavaScript - Concatenating Strings with the Plus Equals Operator

Link to the challenge:

Hello ChickenSalt

Try Removing “;” from the variable name: myStr
The exercise also asks to add a space between the two sentences. Add that at the end of the first one or the beginning of the second one.

Answer:

let myStr;

myStr = "This is the first sentence."

myStr += " This is the second sentence."

console.log(myStr)
1 Like

Hi hiRafa, Thanks for replying.

Unfortunately that isn’t working either… this is what comes up when I put in your answer

myStr
should have a single space character between the two strings.
myStr
should have a value of the string
This is the first sentence. This is the second sentence.
// tests completed

Never mind it was the space that I forgot lmao thanks for your help!

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