Word Blanks - help to understand

Tell us what’s happening:
I really don’t understand how to do this, because none of the earlier exercises were similar to this, so don’t even know where to begin. I don’t really get how to concatenate strings with variables?

  • Do I have to assign all the variables with the strings “dog” “big” etc.
    first? (Tried it but it didn’t seem to work either)

  • Don’t understand “change the words here to test your function”? What should I change it to and for what?

This is what I tried :

Your code so far


function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  // Your code below this line
  var result = "My " + myAjective + myNoun + myVerb + " very " + myAdverb;

  // 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/70.0.3538.77 Safari/537.36.

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

if you’re really stuck, here is a solution.
But i encourage you to solve it thinking about how to use spaces in the string you need to form .
Tip: " " is a space

spoiler

var result = "my " + myAdjective + " " + myNoun + " " + myVerb + " " + myAdverb;

Hey,

I recommend that you use any IDE software (Brackets is pretty simple) or online (like https://jsbin.com/) where you can test your code and see the output in the console.

For example, you can put all the code from this challenge into jsbin and see what happens in the console (make sure to have the correct tabs open). You’d find out that you made one mistake by naming myAdjevice a “myAjective” and after fixing that, that your function runs correctly but there are no spaces between some words.
Bottom line is, it will let you see what’s going on and help in resolving some challenges more easily.

Just remember that you need to console.log the things you want to see in the console, since at FCC you’ll work mostly with the functions and what they’re returning, it’s enough if you log the function call, like console.log(wordBlanks("dog", "big", "ran", "quickly"))

When you’re stuck like this, try to break it down step by step.

Let’s check out what your result variable looks like at each successive + operator.

  1. "My "
  2. “My big”
  3. “My bigdog”
  4. “My bigdogran”
  5. "My bigdogran very "
  6. “My bigdogran very quickly”

It looks like there’s something missing…