Blanking on Word Blanks

Tell us what’s happening:



**Your code so far**

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = “”;
// Your code below this line
var a = "My ";
var b = "and furry ";
var c = "to the store ";
result = “a” + “myAdjective” + “b” + “myNoun” + “myVerb” + “c” + “myAdverb”;

I get the word blanks forming the string. I don't get these two results:
wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
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 am finding a lot of these challenges poorly worded and confusing, and would have no idea to use "return result"; as indicated in the forum. Also, I don't know why the other word blanks like cat and little are there for testing, nor where they should go in the exercise. I really want to learn to code and to stick with FreeCodeCamp vs. CodeAcademy. However, the people who create the challenges really need to be a lot more clear, so I don't know how to get that feedback to the right people.  As for the challenge itself, any help would be appreciated.

  // Your code above this line
  return result;
}

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Safari/604.1.38.

Link to the challenge:

There is no blank space in between the words. It should be like this.

result = “a” + " " + “myAdjective” + " " + “b” + " " + “myNoun” + " " + “myVerb” + " " + “c” + " " + “myAdverb”;
result = “a” + " " + “myAdjective” + " " + “b” + " " + “myNoun” + " " + “myVerb” + " " + “c” + " " + “myAdverb”;
[/quote]```

I don't know what the other " " + should do because I got an error that said unexpected '"" "' so it seems it is not expecting the other quotes.
1 Like

Sorry for overlooking the quotes that you are using around variables. Variables shouldn’t be placed inside the quotes.
It will work fine.

result = a + myAdjective + " " + b + myNoun + " " + myVerb + " " + c + myAdverb + ".";
Thanks @mpsinghk! I found a video here:https://www.youtube.com/watch?v=s82vXQd4rZY
4 Likes

``I managed to simplify the words and remove some variables and the code worked.

1 Like

This should be the actual code

`result = a + " " +  myAdjective + " " + b + " "  +  myNoun + " " + myVerb + " " + c  " " +  myAdverb;