Word Blanks challenge 10/20

Tell us what’s happening:

Ive created some code that was a success but i am unsure what the second half of the challenge is asking.

Your code so far


function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  // Your code below this line
  var result = "There stood a black " + "dog" + " with a " + "big" + " task, that " + "quickly" +" turned face and " + " ran" + " from it !";

  // 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

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

It means you have to make it dynamic. What you have done is something called hard-code.

What if you want to change some words of the sentence easily without going back to the line and change over and over again. That’s why functions with parameters are used for so whatever values that are passed in can substitute variables.

You can replace some words inside

with passed in variables like myNoun or myAdjective, etc… so accept incoming strings.

2 Likes

oooh ok makes sense now thanks