FreeCodeCamp.com - Basic JavaSript - Word Blanks

Link to FreeCodeCamp

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.
You will need to use string operators to build a new string, result, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb.
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.

Sollution

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

  // Your code above this line
  return result;
}

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

Komentáře

  1. cut copy paste this code it will work
    / Only change code below this line
    var wordBlanks = "The "+ myAdjective +" "+ myNoun +" "+ myVerb +" "+ myAdverb +" to catch the ball.";// Change this line
    console.log(wordBlanks);
    // Only change code above this line

    OdpovědětVymazat

Okomentovat

Populární příspěvky z tohoto blogu

FreeCodeCamp.com - Basic JavaSript - Passing Values to Functions with Arguments

FreeCodeCamp.com - Basic JavaSript - Understand String Immutability