Word Blanks - Not Understanding What Is Being Asked

Word Blanks - Not Understanding What Is Being Asked
0.0 0

#1

Tell us what’s happening:
I’ve been stuck on this challenge for a couple days. The instructions are unclear. When I run a test I don’t understand what this means.

“// running test
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).
// tests completed”

Your code so far


function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  // Your code below this line
  var result = "My" + myNoun + "took a" + myAdjective + "shit so" + myAdverb + "it" + myVerb + "away.";

  // 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 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36.

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


#2

The whole point of this exercise is to use the values passed into the wordBlanks function and then return a complete sentence. You are using the values passed into the function, but you are not returning a sentence. See below for the string you are returning with wordBlanks(“dog”, “big”, “ran”, “quickly”). You need some spaces and punctuation (non-word characters) to create a proper sentence.

‘Mydogtook abigshit soquicklyitranaway.’


#3

Ok, but where does “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).” come into play here?


#4

The first argument passed into wordBlanks is the value “cat”. This corresponds to the myNoun parameter defined by the function. So when you used myNoun inside the function, it is really just the value “cat”. The same goes for the 2nd, 3rd, and 4th function arguments.

Inside your function, you just need to add some spaces (before and/or after) the extra words you have chosen to use for your sentence, so the spaces become part of the string to create an actual sentence (which has spaces between the words).


#5

The return value from word blanks should be a sentence, with the words [given as arguments] in order, separated by spaces (and any other words or punctuation you want to put between them)


#6

Hi I’m not sure if this thread is still open, but I’m having the same problem here, it keeps asking me for nonword characters, which I’m assuming are spaces. However I have put spaces within my quotations and I have tried it with and without spaces between my plus signs, all to no avail.

What am I missing here?

Thanks in advance

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  // Your code below this line
  var result = "My " + myAdjective + "fluffy " + myNoun + "heard a noise " + myVerb + "and barked " + myAdverb + "like a little girl.";

  // Your code above this line
  return result;
}

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