Help please on Javascript task

Tell us what’s happening:

I’ve followed the rules for the below challenge and I still can’t seem to pass the test. I’m concatenating strings using the + operator. Both phrases are correct but I still get an error code. Any ideas?

Your code so far


const myStr= "This is the start." + "This is the end."; // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15

Challenge: Concatenating Strings with Plus Operator

Link to the challenge:

From the instructions:

“Be sure to include a space between the two strings.”

Hi @bbsmooth, I’ve put a space between the two strings and I’m still getting the error;
myStr should have a value of the string
This is the start. This is the end.

I’ve followed how the string should be completed in the video hint and how they have done it so I’m a bit puzzled.

How does your code look with the extra space, inside one of those two strings?

console.log("This is the start." + "This is the end.") // This is the start.This is the end.

There’s no space between the two sentences. Insert a space at the end of the string or at the beginning of the second string should solve it.

"This is the start. " + “This is the end.”

HI @SC92 !

When your code is not working it is best to use console.log to see the issue. I have added two here to represent the correct output and your output.

const myStr= "This is the start." + "This is the end."; // Change this line

//correct answer
console.log('This is the start. This is the end.')
//your answer
console.log(myStr) 

You should see this result in the console.

That should help you see the spacing issue everyone has mentioned.

Hope that helps!

2 Likes

Thanks. Task solved.

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