wordBlanks js challenge

Tell us what’s happening:

I can not figure out why this code won’t run, can someone look and give me a clue?

Your code so far


var myNoun = "dog";
var myAdjective = "big";
var myVerb = "ran";
var myAdverb = "quickly";

// Only change code below this line
function wordBlanks(myNoun, myVerb, myAdjective, myAdverb) { 


var result = "";

result += "The " + myAdjective + "" + myNoun + "" + myVerb + " across the lot "  + myAdverb + " to play."; 
return result;
}
// Change this line
// Only change code above this line


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36.

Challenge: Word Blanks

Link to the challenge:

The test don’t really expects a function, and is not really instructed to run one;
looking at the original challenge state:

// Only change code below this line
var wordBlanks = ""; // Change this line
// Only change code above this line

Seems the test expect a wordBlanks variable (possibly a string) not a function.
Hope it helps :slight_smile:

Ok I fixed that part now Im getting this error

wordBlanks should contain all of the words assigned to the variables myNoun, myVerb, myAdjective and myAdverb separated by non-word characters (and any additional words in your madlib).
// tests completed```

what’s your code now?


var result = "";

 result += "The " + myAdjective + " " + myNoun + " " + myVerb + " across the lot "  + myAdverb + " to play.";

The challenge is expecting a variable called wordBlanks to test,

while you created yours in a variable called result :slight_smile:

Thank you. I was making it harder than it should of been.

Sorry for the late reply @Tashaf, glad you could pass it.

Just for reference the challenge could have been done with a function as you originally started, the only important thing is that the wordBlanks variable would hold the correct value.

For example:

var myNoun = "dog";
var myAdjective = "big";
var myVerb = "ran";
var myAdverb = "quickly";

function createString() { 
// do your magic here
return `I am just an example`;
}

wordBlanks = createString();

Happy coding :slight_smile: