Word Blanks help

Word Blanks help
0

#1

Hi, I cannot undestand what is the expected output for this quest…

I dont know how madlibs works… Do I need to know that? Cause i really dont care, too much to learn alredy/

What is the expected output?


#2

No need to know how MadLibs work, I didn’t know either. Just follow the instructions, they seemed pretty straight forward to me.


#3

Madlibs is a children’s game. One person has a story with important words left blank. That person asks the other person/people “OK, give me an adjective” and he/she fills that word into the story. They do this for several words and then after all the blanks are filled in, the person reads back the new story which is often nonsensical and funny.

For this program, you are supposed to create the story and the words to be inserted will be sent to your function. For example, a simpler version might be:

function wordBlank(myNoun) {
  var result = "The " + myNoun + " went to the moon.";
  return result;
}

I just made up the “went to the moon” part. Whatever the function sends, will be added to it.


#4

Hello Nanquim,

Your writing suggests that you are a bit fed up with it. In that case, take a break for a while.
This is just like a gap-fill activity, so the end result, will be a full sentence:

You’ve got this function called wordBlanks that receives arguments (myNoun, myAdjective, myVerb, myAdverb). Those arguments get their values from the function call at the end of the script: wordBlanks(“dog”, “big”, “ran”, “quickly”); So, myNoun will become dog, and myAdjective becomes big, etc.

The var result is what we will see on the screen. At the moment it is empty var result = " "; so what we need to do is start writing a sentence (in quotation marks), and when we want to use the myNoun, myAdjective… arguments, we close the quotation, and simply use the + symbol to include the argument. Anything that is normal text we added needs to be in quotation marks (“Start of the sentence " + argument + " more sentence " + argument + " the end.”). So, now the variable ‘result’ is going to look more like this:

result = “The " + myNoun + " had " + myAdjective + " back legs.”;

The output will look like a normal sentence: The dog had big back legs.

And remember, you can use the arguments in any order in the sentence.


#5

Yes, I was tired. I just had to add blank spaces… :grimacing: It was very easy, actually.

Thank you