JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge

space

having trouble creating the spacing in document.write() example verb and adjective come as one no space is created.

var noun = prompt('type a noun'); var verb = prompt('Type a Verb'); var adjective = prompt('Type here a Adjective');

document.write(' there is a humble queen named '+noun+' And is very '+ verb + adjective +' The end ');

2 Answers

Scott Wyngarden
PRO
Scott Wyngarden
Pro Student 16,700 Points

All you need to do is add in another string that's just a space " "

It might be easier to see if you space out the code a little differently

var noun = prompt('type a noun'); 
var verb = prompt('Type a Verb'); 
var adjective = prompt('Type here a Adjective');

document.write(' there is a humble queen named ' + 
 noun + 
' And is very ' + 
verb + 
' ' + 
adjective +
' The end ');
Steven Parker
Steven Parker
203,226 Points

Just add a literal space between the items.

So instead of "verb + adjective", you might write "verb + ' ' + adjective".