Word blanks how to assign the variables correctly

Hi i’ve having trouble with this exercise:
In this challenge, we provide you with a noun, a verb, an adjective and an adverb. You need to form a complete sentence using words of your choice, along with the words we provide.

You will need to use the string concatenation operator + to build a new string, using the provided variables: myNoun , myAdjective , myVerb , and myAdverb . You will then assign the formed string to the wordBlanks variable. You should not change the words assigned to the variables.

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.

this is what my code is thus far:

var myNoun = "dog";

var myAdjective = "big";

var myVerb = "ran";

var myAdverb = "quickly";

// Only change code below this line

var wordBlanks = "My" + myAdjective + "and dumb" + myNoun + "has" + myVerb + "very" + myAdverb + "into the street."; // Change this line

// Only change code above this line

I have gotten passed marks for all the sub assignments except the last one they are as follows:

wordBlanks should be a string.

Passed

You should not change the values assigned to myNoun , myVerb , myAdjective or myAdverb .

Passed

You should not directly use the values “dog”, “ran”, “big”, or “quickly” to create wordBlanks .

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).

how would I go about achieving a passed score for the last one when the one before that states that I should not directly use the vales of the words for the variables.

4 Likes

I’d suggest you console.log out wordBlanks to see what is wrong.


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

Please use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.

markdown_Forums


If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

thanks! i was wondering how ya’ll did that.

Tell us what’s happening:
I’m having trouble completing this exercise. At this point with the code I have written I have accomplish 3 of the 4 tasks that I need to to complete to pass this exercise. They are as follows:

wordBlanks should be a string (check)
You should not change the values assigned to myNoun, myVerb, myAdjective or myAdverb. (check)
You should not change the values assigned to myNoun, myVerb, myAdjective or myAdverb. (check)
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). (X)

I do not know how I would do the last task. Can someone please help me understand.

Your code so far


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

// Only change code below this line
var wordBlanks = "My" + myAdjective + "and dumb" + myNoun + "has" + myVerb + "very" + myAdverb + "into the street."; // Change this line
// Only change code above this line

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Word Blanks

Link to the challenge:

try to add console.log(wordBlanks) as last line of your code to see the value of that variable

3 Likes

ah i see it was a spacing issue thank you so much for your help!

var wordBlanks = "My "+ myAdjective +" and dumb " + myNoun +" has "+ myVerb +" very "+ myAdverb +" into the street. ";

The issue I having was a spacing one, the above code successfully lead to me being able to proceed the next exercise.

1 Like