Word Blanks what am I doing wrong

Tell us what’s happening:

Your code so far


function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  // Your code below this line
  var result = "";
  result+="my " +myAdjective+ "brown " +myNoun+ "has " +myVerb+ "very " +myAdverb+ "home";

  // Your code above this line
  return result;
}

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15.

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

You are missing spaces after each of your adjectives/nouns/verbs. Just stick a space before each of your literal strings (the strings in quotes)

you can see what your string is if you add console.log(result) below where you are writing the string, so you will see what the value of result is in the console

1 Like
result += "my " + myAdjective + " brown " + myNoun + " has " + myVerb + " very " + myAdverb + " home";

you forget the space in between the variables

1 Like

All okay, just you need to do:

var res = wordBlanks("cat", "little", "hit", "slowly");
console.log(res);

or

console.log(wordBlanks("cat", "little", "hit", "slowly"));

or

alert(wordBlanks("cat", "little", "hit", "slowly"));
1 Like

you answer was very helpful.thank you good sir