Concatenating Strings with the Plus Equals Operator question

Concatenating Strings with the Plus Equals Operator question
0

#1

Tell us what’s happening:
What am I doing wrong?

Build myStr over several lines by concatenating these two strings: "This is the first sentence. " and "This is the second sentence." using the += operator. Use the += operator similar to how it is shown in the editor. Start by assigning the first string to myStr , then add on the second string.

Your code so far
var myStr = “This is the first sentence”;

myStr += “This is the second sentence.”


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

// 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 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.2988.0 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator


#2

You are missing a space and a dot at the end in the first string (also a semicolon but i don’t think the tests cares about that).


#3

Thank you very much!


#4

Hello @jdiggity

I am having the same problem

here is my code var myStr = 'This is the first sentence.'; myStr += 'This is the second sentence.';

Where did i go wrong here


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

or maybe that one


#6

Your string is missing a space


#7

I have added spaces still not accepting

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

#9

Why the space at the end of the second string? That is counted as an error, as the tests match the string exactly


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

Still not accepting. note i have spaces after = sign and += signs as well


#11

Thanks for helping out though :grinning:


#12

The spaces outsides the quotes don’t matter, it’s inside the quotes you are missing a space
You just returned to the above situation, you just need to add a single space so that there is a space, as is grammatically correct, between the full stop and the following letter


#13
// Only change code below this line
var myStr = "This is the first sentence. ";
myStr += "This is the second sentence.";

The first sentence. Whooooo this has been quite educational i might say, finally accepted


#14

var my = “HI HEllo”;
my += " HI BYE BYE";

Run this in your console.
Only you need space. before your Double inverted comma.

Or else try this thing
var my = ‘HI HEllo’ + ’ HI BYE BYE’;


#15

@caseyanmol hi dude
my code was accepted