The sentence of the answer

Hi Guys,

In the right answer there´s a space between the final point and the double quotes.

It´s a little bit hard to find that mistake when not using “ctrl+c , ctrl+v”.

My sugestion is to eliminate that space. Because in the second sentece it doesn´t exist.

Your code so far


// Only change code below this line

var myStr = "This is the first sentence. ";
myStr += "This is the second sentence.";

Your browser information:

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

Challenge: Concatenating Strings with the Plus Equals Operator

Link to the challenge:

The space at the end of first sentence is intentional. So that when you join two strings using += there is a space between these sentences.

You can always use console.log to check how does the string look like to find any possible bugs :wink:

1 Like

the space is before the quotes… not after.

What do you mean?

// Without space at the end
var myStr = "This is the first sentence.";
myStr += "This is the second sentence.";

console.log(myStr);
//  -> This is the first sentence.This is the second sentence.


// With space
var myStr = "This is the first sentence. ";
myStr += "This is the second sentence.";

console.log(myStr);
//  -> This is the first sentence. This is the second sentence.

it´s probaly a mistake from who made the task!

what do you think is a mistake?

1 Like
// Without space at the end
var myStr = "This is the first sentence.";
myStr += "This is the second sentence.";

console.log(myStr);
//  -> This is the first sentence.This is the second sentence.

                                 /\
                                /  \
                               /    \
                                |  |
                                |  |
                                |  |
                                |  |
                                |  |
               There's a space missing after that period





// With space
var myStr = "This is the first sentence. ";
myStr += "This is the second sentence.";

console.log(myStr);
//  -> This is the first sentence. This is the second sentence.