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)

I dunno how to pass this problem. Can someone please tell me what’s wrong with my code?

Thansk!

Your code so far


function wordBlanks(myNoun, myAdjective, myVerb, myAdverb, a, b, c, d) {
  // Your code below this line
  var result = "";
  
  var myNoun = "bat";
  var myAdjective = "small";
  var myVerb = "walk";
  var myAdverb = "slowly"
  var a = "cat";
  var b = "little";
  var c = "hit";
  var d = "slowly";

  result = "The " + myAdjective + " and" + " feisty " + myNoun + " have " + myVerb + " very " + myAdverb + "." + " My " + b + " " + a + " has" + " been " + c + " " + d + ".";


  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("bat", "small", "walk", "slowly", "cat", "little", "hit", "slowly");


Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

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

Your phrase is good, your issue is here - the variables already have a value because they are the function parameters, you are overwriting the expected values

You will need to remove the initialisation of variables from inside the function, and also don’t add new parameters in the function, they are not contemplated and the tests will not have arguments for those parameters

1 Like