Problems with Word Blanks

Tell us what’s happening:

Dear all,
I am having problems with the last part of my code in this challenge of Word Blanks
It seems that the first 2 parts are fine, and then the last part although i changed it in several ways,
it always give me back this message:
wordBlanks(“cat”, “little”, “hit”, “slowly”) should contain all of the passed in words separated by non-word characters (and any additional words in your madlib)
I attach here my code and i will appreciate and thank you so much if someone can help me to overcome this challenge and understand why my last part is wrong.

Kind regards,
Ivonne

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
// Your code below this line
var result = “”;
myNoun = " dog " ;
myAdjective = "big " ;
myVerb = " ran ";
myAdverb = " quickly “;
result += " My " + myAdjective+ “” + myNoun + " " +myVerb+” very "+ myAdverb + “.” ;

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks( "cat ", “little”, “hit”, “slowly”);


**Your browser information:**

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

**Link to the challenge:**
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/word-blanks/

Hi there, this one is from wanzulfikir he helped me before same topic

I’ll try to explain the best I can.

KittyKora:

var result = “myNoun” + “myAdjective” + “, myVerb” + “myAdverb” ;

When you use “myNoun” with the quotes, you are actually using a literal string rather than a variable.

“myNoun” - a string of characters that spells myNoun (or a combination of characters “m” + “y” + “N” + “o” + “u” + “n”)

myNoun - a variable (observe the no quotes) that can contain many things. In this case, it can refer to any string you want. It can contain the string “dog”, “cat”, “human”, or anything.

In your result , try removing the quotes and you’ll get the variables.

(i am having same issue with this lesson maybe we can figure iit out together :3)

You are re-assigning a new “fixed” value to all your function parameters:

 wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
myNoun = " dog " ;
// it doesn't matter what value myNoun originally had, 
// now it will always be dog
}

The same applies to the other arguments.

Hope this helps :+1:

1 Like

Dear KittyKora,
Good mornings,

I appreciate and thank you so much your kind help, i am sorry for my
delay in the reply, i have finished the challenge and it worked good,
thank for the explanation also.

Here i send you a picture of my code :slightly_smiling_face:

I wish you a beautiful day KittyKora,

Kind regards,

Ivonne

1 Like

Dear Marmiz,
Good morning,

I appreciate and i thank you so much for the kind orientation and your time,
i am sorry for my late reply, finally i solved the problem and i find myself very happy about it,
thank you again for the explanation, and i wish you a lovely day as well as good vibes.

Kind regards,

Ivonne

Is that your final code in the picture you posted? If so you are not using the function parameters/arguments correctly.

It is understandable as it has not been taught yet (that has been fixed but the site is not updated yet), look at this post and see if it makes sense.