JavaScript : wordBlanks

Tell us what’s happening:
Hi campers please I need help to complete JavaScript : wordBlanks. I have tried several things, but I keep getting this : ```
wordBlanks should contain all of the words assigned to the variables myNoun
myVerb ,myAdjective, and myAdverb separated by non-word characters (and any additional words in your madlib).
Thanks for your help & support .

Here’s what have tried again -


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

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

// 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/87.0.4280.88 Safari/537.36.

Challenge: Word Blanks

Link to the challenge:

Hello there,

It seems like you are not assigning properly to wordBlanks variable.

For instance

var wordBlanks = "My  ";
wordBlanks = wordBlanks + 'goodness!';

should make wordBlanks equal to “My goodness!”

Hi, I have followed your correction but it’s still not working.

Make sure that you are doing everything in a single line as told in the instructions. i.e. declare and assign wordBlanks at the same time.
Do not alter the structure of the coding area.

// Only change code below this line
var wordBlanks = ""; // Change this line
// Only change code above this line

I think I did that before. It’s still the same -
see what I have done :
var myNoun = “dog”;

var myAdjective = “big”;

var myVerb = “ran”;

var myAdverb = “quickly”;

// Only change code below this line

var wordBlanks = '"My "+myAjective+ myNoun+ myVerb+ myAdverb+ "for "+“the “+“bone”+”.” '; // Change this line

// Only change code above this line

Oh I see your mistake.

You should add a space between each variable as told by the instructions.

You will also need to account for spaces in your string, so that the final sentence has spaces between all the words. The result should be a complete sentence.

what you wrote now should be printing out something like “My bigdogranquicklyforthebone.”

You see there are no spaces there.

for example:

var wordBlanks = "My" + " " +'goodness!';

should print “My goodness!”

1 Like

:grinning:
I appreciate but still not working see the corrections I have made below :grinning:
// Only change code below this line

var wordBlanks = '“My” + " " + myAjective + " " + myNoun +" " + myVerb + " " + myAdverb + " " + “for” + " " + “the” + " " + “bone”+"." '; // Change this line

// Only change code above this line

First of all you have a typo there. It should be myAdjective, not myAjective.

Second of all you should be using single (’) or double quotes (") to wrap your strings.

One mistake you do is you are wrapping everything inside a set of single quotes. Remove those from the beginning and the end.

Second mistake you do is you are wrapping your words inside these symbols => “ ”
Only use single or double quotes.

Compare your code to this:

var wordBlanks = 'My' + " " + myAdjective + " " + myNoun +" " + myVerb + " " + myAdverb + " " + 'for' + " " + 'the' + " " + 'bone'+"." ; 
1 Like

It worked :+1: you are the best!
thanks.

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