Use of " " after each variable

Tell us what’s happening:

Could some one tell me what is us of " " after each variable ? and why after las t variable adverb was not used " " before " . "
Thanks.

Your code so far


var myNoun = "dog";
var myAdjective = "big";
var myVerb = "ran";
var myAdverb = "quickly";

// Only change code below this line
var wordBlanks = " The " + myAdjective + " " + myNoun + " " + myVerb + " " + myAdverb + "."; // Change this line
// Only change code above this line

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5.

Challenge: Word Blanks

Link to the challenge:

You mean here:

var wordBlanks = " The " + myAdjective + " " + myNoun + ...

That is just a string with a single space, otherwise all the words would run together. You also could have done:

var spaceString = " ";
var wordBlanks = " The " + myAdjective + spaceString + myNoun + ...
1 Like

Got it. Thanks a lot.

The empty strings tripped me up too when I first started.

In the next section (es6) you learn another way on how to create strings which will get rid of the plus signs and extra empty strings.

var wordBlanks = `The ${myAdjective} ${myNoun} ${myVerb} ${myAdverb}. `