Basic javascript: Word Blanks... instructions are confusing

Basic javascript: Word Blanks... instructions are confusing
0
#1

are the directions telling me to provide 8 variables for the function? (the dog…and the cat, 4 each). The directions are ambiguous.
I mean, the JS itself is fairly simple. I can write working code that’ll run in brackets or the chrome developer, but FCC is looking for something very specific. The directions, like 3/4 of all the other problems read like they’re written by someone who didn’t take the time to convey expectations. I could have completed the entire course by now but 90% of my effort is spent on parsing the directions.

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

// Your code above this line
return result;
}

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

What am I misunderstanding , given this code…BTW, I’m not using curly quotes. The problem wants me to pass in 8 string literals into 4 function variables. Are we supposed to loop through the function twice?

1 Like

#2

If you can be more specific about what information you think is missing or inaccurate in the challenge, someone can address it.

0 Likes

#3

thanks for the quick response.
the following is what I get when I run the code above:

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

0 Likes

#4

Don’t forget the requirment that all the words be surrounded by spaces.

0 Likes

#5

oh crap, that was it…lol…
thanks

0 Likes

#6

Glad to help. Happy coding.

0 Likes

#7

// running tests

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

0 Likes

#8

People can’t help you unless we can see your code.

0 Likes

#9

First of all the challenge itself is not clear with poorly framed and confusing question. Despite reading multiple times I don’t understand what the question expects. Can the FreeCodeCamp look after this question and change it?

I saw few feedbacks asking to use the following: (but did not work)
result+= “My “+myAdjective+” “+myNoun+” “+myVerb+” very “+myAdverb+”.”;

So I used the following and it worked:
return ("The " + myAdjective + " " + myNoun + " " + myVerb + " " + myAdverb);
{note: you need to delete “return result” before executing}

1 Like