Basic JavaScript - Word Blanks

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

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

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Word Blanks

Link to the challenge:

I’m really confused as to what I’m supposed to do.

Ah, you’re on the right track but you misunderstand the syntax slightly. You don’t need to wrap quote marks around variable names. That simply turns the text into a string.
The other thing which you need to bear in mind is that you need to include spaces in your strings, so that your words don’t just all run into each other.

1 Like
const myNoun = "dog";

const myAdjective = "big";

const myVerb = "ran";

const myAdverb = "quickly";

// Only change code below this line

const wordBlanks = "The " + myAdjective + "black " + myNoun + myVerb + "home " + myAdverb + "."; // Change this line

// Only change code above this line

Like this?

You are so close! Just remember that you need a space in between each word; otherwise, the sentence is smushed together.

This approach to concat strings is outdated! you better use backticks “`”
Read this on MDN

1 Like

What are backticks, please? I just started JavaScript, so I don’t know it

Should I put a space before and after the word, because putting a space after each word didn’t make a difference

I was able to complete the challenge. I really appreciate all the help I received. Thank you!!

backticks makes it 100 times easier to concat string
"Ahmad " + " Addel" + "!"
becomes

`${firstName} ${lastName} !`
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.