Freecodecamp: Word Blanks!

Created on 5 Aug 2016  Â·  17Comments  Â·  Source: freeCodeCamp/freeCodeCamp

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?
https://www.freecodecamp.com/challenges/word-blanks

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}

help wanted

Most helpful comment

Sounds good. Let's change the instructions to something like this

We will now use our knowledge of strings to build a "Mad Libs" style word game we're calling "Word Blanks". You will create an (optionally humorous) "Fill in the Blanks" style sentence. Here's an example incomplete sentence.

"The ______ ______ looked around ______ then ______ into the house"

These four blanks would be filled in this order: (adjective) (noun) (adverb) (verb)

You will need to use string concatenation to build a new string, result, using the variables myNoun, myAdjective, myVerb, and myAdverb. These variables are passed to the function as parameters. Don't change these parameter names in the function.

Include additional strings and spaces (which will not change) in between the provided variables to make a complete sentence.

If I'm missing anything from my synthesis, let me know 😄

All 17 comments

Mind sharing which specific parts of the instructions and/or test cases weren't clear?

/cc @FreeCodeCamp/issue-moderators.

This challenge does come up in the HelpJavaScript chat regularly. Maybe it could benefit from an example in the instructions rather than an outbound link to the wikipedia page on Mad Libs (which I suspect people don't easily connect conceptually to the challenge).

I agree with @BKinahan on having an example. Usually the tests will give you an idea of what the sentence should look like. But this challenge's tests are very broad for someone not fully understanding the concept of a MadLib.

The instructions

You will also need to use additional strings, which will not change, and must be in between all of the provided words. The output should be a complete sentence.

We have provided a framework for testing your results with different words. The tests will run your function with several different inputs to make sure all of the provided words appear in the output, as well as your extra strings.

could also use some rewording. I feel like some of it is unnecessary to mention.

I'm really stuck here and the chat wasn't able to help. More ideas please. A little example is really necessary here I didn't even knew where to start. it passed with what Bhargavbonu wrote but not really sure what I did there. I'll try to figure out the sense out of it.

People doesn't really pay attention to a description that much and those are the people mostly in help chat. They surely don't go to read some article on Wikipedia. Some example would be good, but it would also make it way too easy. Also check have to fail, if example is copied to code.

Word Blanks was the only one exercise that i didn't get it well at Basic Javascript. Maybe a example would be great. But i still think the text needs to be changed.

Would this make it easier to understand?

You will also need to use additional strings, which will not change, and must be in between all of the provided words. The output should be a complete sentence. See example of sentence below:

wordBlanks("people", "clouds", "go", "day");

This would output:
_Some_ people _are like_ clouds_. When they_ go _away, it's a brighter_ day_._

Note: You will have to invent these unbolded words yourself and these will not change if bolded wordBlanks variables change.

Below is my suggestion for modifying the instructions (changes in bold):


We will now use our knowledge of strings to build a "Mad Libs" style word game we're calling "Word Blanks". You will create an (optionally humorous) "Fill in the Blanks" style sentence.

To do so, you will need to use string concatenation to build a new string, result, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb that are passed to the function as parameters. Do not change the parameters in the function.

Include additional strings and spaces (which will not change) in-between the provided variables to make a complete sentence.

We have provided a framework for testing your results with different words. The tests will run your function with several different inputs to make sure all of the provided words appear in the output, as well as your extra strings.


I'm undecided on how I feel about including the example because I think it could lead campers to believe they need to change the parameters in the function.

@dhcodes have we previously defined "concatenation"? That is a pretty big scary word for someone who hasn't seen it before. Hence my use of the word "strings" instead. You could alternatively say "you will need to combine strings" which is clear and jargon free. Sure, campers should eventually get familiar with these jargon, but this probably isn't the best place to do so.

Also, "in between" is not hyphenated in American English.

As @Locheed pointed out, people don't usually read the description, and making the description even longer will make people even less likely to read it.

I suspect adding extra examples may be superior to adding so much additional description text.

Concatenation is previously introduced in the three consecutive challenges:

... all not long before Word Blanks in the Basic JavaScript section, and those challenges are often referenced in the HelpJavaScript chat when a user asks about Word Blanks.

I think the concatenation concept is sufficiently reinforced by this point (perhaps aside from cases where campers take a break from learning and then return to Word Blanks), and the true issue is that the challenge instructions assume either a cultural familiarity with the MadLibs game (which I have learned is not as widespread as I once thought!), or that users will scroll down far enough on the linked Wikipedia page to see an example of its fill-in-the-blanks structure.

I agree the instructions should include an example, but I'm not sure about the form it should take. Maybe showing the fill-in-the-blank structure directly will be clearer, and also provide a prompt to users who aren't in a creative enough mood to write their own sentence (a lot of solutions simply include the input variables concatenated with single spaces, for example, rather than adding any linking words).

Something like:

"The ______ ______ looked around ______ then ______ into the house"
These blanks would be filled in this order: (adjective) (noun) (adverb) (verb)

(As an aside @dhcodes "in-between" is sometimes used hyphenated, but only as an adjective (or a noun form of the adjective), eg "not quite awake or asleep, but in some in-between state", or "light, dark, and all the in-betweens." But it's correct that it should not be hyphenated in the way you use it 😄 The more you know ✨ )

Good points all around. The reason I recommended mentioning concatenation is my experience in the chat room where users who say they understand the instructions often say "I still don't know how to make the sentence" or "I don't know where to start" and mentioning concatenation usually sets them on the right path (if only as a search term to help trigger their memory). This does run of making the challenge too easy, though.

I like @BKinahan's example of showing what a MadLibs game is too.

@dhcodes @BKinahan OK - thanks for pointing this out. Please go ahead and use concatenation then. I should have checked that before opening my mouth :)

I agree - @BKinahan's example text is great - I think it will go a long way toward clarifying what a mad lib is.

Sounds good. Let's change the instructions to something like this

We will now use our knowledge of strings to build a "Mad Libs" style word game we're calling "Word Blanks". You will create an (optionally humorous) "Fill in the Blanks" style sentence. Here's an example incomplete sentence.

"The ______ ______ looked around ______ then ______ into the house"

These four blanks would be filled in this order: (adjective) (noun) (adverb) (verb)

You will need to use string concatenation to build a new string, result, using the variables myNoun, myAdjective, myVerb, and myAdverb. These variables are passed to the function as parameters. Don't change these parameter names in the function.

Include additional strings and spaces (which will not change) in between the provided variables to make a complete sentence.

If I'm missing anything from my synthesis, let me know 😄

Is someone working on this one, or can I try it?

@mtroiani go for it! Please first read the contributing guidelines before taking care of this issue. And feel free to visit the Contributors Help chat room if you have any questions about helping. We're there to help.

Took me a while but the in-betweeen/add-on words had to be spaced on both sides, right at the beginning quotation marks and before the end quotation marks for each added string. I also agree that it wasn't quite clear with the instructions initially.

i'm confused about this question

Was this page helpful?
0 / 5 - 0 ratings