Word Blanks has some trouble with his Blanks

Tell us what’s happening:

I tried many answers I thought were correct, but all were wrong.I’m not sure what went wrong. Please help me.

Your code so far


function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  // Your code below this line
  //var result = "";
  //result+= "dog"+myNoun+"big"+myAdjective+"ran"+myVerb+"quickly "+myAdverb;
var result = "dog"+"is"+"big"+"and"+"ran"+" quickly ";
  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog","big", "ran", "quickly");

Your browser information:

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

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

this one is the best one you have, even if with this you get a nonsensical sentence, because here you are using the provided variables. Though you are missing spaces between the words.
Right now, with your code, result in the two function calls used for tests has values of:

"dogisbigandran quickly "
"dogisbigandran quickly "

The second call that passes in "cat", "little", "hit", "slowly" should be different.

With your best version the value is:

"dogdogbigbigranranquickly quickly"
"dogcatbiglittleranhitquickly slowly"

They are different from each other, and that’s good, but you should separate the words with spaces

1 Like

I’m still confused.I felt a little foolish myself, and I made more mistakes.Is the space between two words?So does the “cat” sentence go with the word “dog”?
Like this:
result+= "dogcat"+""+myNoun+"biglitter"+""+myAdjective+"ranhit"+""+myVerb+"quicklyslowly "+myAdverb
(Sorry for the late reply, I just realized that I replied the wrong post.)

No, the word dog or the word cat are the possible values of the variable myNoun

The variables myNoun, myAdjective, myVerb, myAdverb have once values of "dog", "big", "ran", "quickly" and once values of "cat", "little", "hit", "slowly", so you don’t need to include at all those words in what you type in, they will be put in place of the variables by the code

You also still not have spaces, "" is just an empty string, this is a space: " "

1 Like

Cool!You are amazing!!!Thank you so much.