0

I am inserting specific word into a sentence with concatenation but the words a running together with no space between them.

var adjective1 = + 'amazing';
var adjective2 = + 'fun';
var adjective3 = + 'entertaining';



var madLib = 'The Intro to JavaScript course is'   + adjective1 +  'james and Julia are so'  + 
adjective2 + 'I cannot wait to work through the rest of this' + adjective3 + 'content!';
console.log(madLib);

1 Answers1

1

Just add spaces

var madLib = 'The Intro to JavaScript course is '   + adjective1 +  ' james and Julia are so'  + 
adjective2 + 'I cannot wait to work through the rest of this ' + adjective3 + ' content!';

You also shouldn't have + before the strings in the variable assignments. That will try to convert the strings to numbers, and will produce NaN since they're not numeric.

var adjective1 = 'amazing';
var adjective2 = 'fun';
var adjective3 = 'entertaining';
Barmar
  • 741,623
  • 53
  • 500
  • 612