Word Blanks challenge1

Word Blanks challenge1
0.0 0

#1

Hey guys, what’s wrong with my code?

Tell us what’s happening:

Your code so far

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb, e, f, g, h) {
  var result = "";
  // Your code below this line
  
  myNoun="dog";
  myAdjective="big";
  myVerb="ran";
  myAdverb="quickly";
  e= "cat";
  f="little";
  g= "hit";
  h="slowly";
  
result="my huge " + myNoun + " took a " + myAdjective + " dump in the woods as he " myAdverb + myVerb + " through the woods. my " + e +" is a " + f + " big to " + g " the tree. He " + h" scratches trees.";
  // Your code above this line
  return result;
}

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:


#2

Just forgot some string concat operator(+)

" dump in the woods as he " myAdverb --to–> " dump in the woods as he " + myAdverb

g " the tree. He " --to–> g + " the tree. He "

h" scratches trees." --to–> h + " scratches trees."

You should also declare the input args outside the function, not inside.

Also init and declare as empty string forresult is redundat

Your final could be something like this

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb, e, f, g, h) {
  var result;
  // Your code below this line
result="my huge " + myNoun + " took a " + myAdjective + " dump in the woods as he " + myAdverb + " " + myVerb + " through the woods. my " + e +" is a " + f + " big to " + g + " the tree. He " + h + " scratches trees.";
  // Your code above this line
  return result;
}

var myNoun="dog";
var  myAdjective="big";
var  myVerb="ran";
var  myAdverb="quickly";
var  e= "cat";
var  f="little";
var  g= "hit";
var  h="slowly";

// Change the words here to test your function
wordBlanks(myNoun, myAdjective, myVerb, myAdverb, e, f, g, h);

Always review your code every single statement you code.

Happy programming, keep going on good work.