Basic JavaScript: Concatenating Strings with Plus Operator

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

Pulling my hair out with this,what am I doing wrong please.

here my understanding

  1. I have declared the variable myStr
  2. the value is simply 2 sentences added together
  3. I have put each sentence in “”


I’ve edited your post for readability. In particular, I enclosed your code in single backticks, not single quote marks.

The instructions from the challenge…

Build myStr from the strings "This is the start. " and "This is the end." using the + operator.

Your code…

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

Do you see any differences?

Spaces, my friend, spaces.
Will be the bane of your existence if you don’t consider them. Consider them and you will have much less difficulties in some challenges.

im sorry I do have spaces, can you please be more specific,this is a bit cryptic.


If you concatenate 2 strings like "Hello" + "World" it will turn out "HelloWorld". You want to make sure that there is a space at the end of the first string.

OK let me really get this into my thick skull…see my code

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

There is DEFINITELY a space before and after the ‘+’ symbol.

thanks for getting back to me but your answer is a little cryptic for me, are you able to rephrase please, this challenge is just getting the best of me.

"Hello. "

Where is the space in this string?

As an example, "one" + "two" will give onetwo.
"one " + "two" will give one two

You don’t need spaces before and after the + symbol, it works anyway. Those are to make the code more tidy and easier to read
This is totally valid:

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

You are missing spaces inside the string. Right now it has value of This is the start.This is the end.