Word Blanks cant seem to get it right

Tell us what’s happening:

Your code so far


function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  // Your code below this line
  var result = myNoun + " is " + myAdjective + " and "  + myVerb + myAdverb;

  // Your code above this line
  return result;
}

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0.

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

returns
dog is big and ranquickly
and
cat is little and hitslowly

so you need to add a space in between myVerb + myAdverb

I have the same problem.

I tried the code and used spaces in my own exercise but it still won’t accept.

It keeps saying:
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).

1 Like

@eialici

myVerb + myAdverb are two strings without whitespace, so you’ll need a space between them as well.

Thanks a lot. Finally got through it

2 Likes

Sorry but I tried that, still won’t work:

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  // Your code below this line
  var result = "My " + myNoun  + "is very " + myAdjective  + "but " + myVerb  + "away " + myAdverb;

  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
wordBlanks("cat", "little", "hit", "slowly");
wordBlanks("monster", "giant", "smash", "fast");

If you want to add a space between variables, you have to explicitly add the space

var result = var1 + ' ' + var2...
1 Like

Thanks so much JM, this got it to work.
It’s amazing how closely typo’s can interfere with the soundness of the code.

I am an accountant who wants to move to programmer, in accountancy accuracy is key, but it seems that in programming its even more important :slight_smile:

JM, thanks for the info. I was having a heck of a time with this one.

  var result = "My "+myNoun+" isn't "+myAdjective+" and never "+myVerb+" "+myAdverb+".";