My dog is Stock in the Word Blanks

My dog is Stock in the Word Blanks
0.0 0

#1

Tell us what’s happening:

I don’t know what I am doing wrong. Have read and followed the instructions from the other posts yet I don’t seem to be able to pass the challenge.

Thanks for your help in advance.

Your code so far


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

var result = "My " + myAdjective + " " + 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 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

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


#2

hint: problem between myVerb and “very”.
console.log(result) to see the bug yourself.
goodluck


#3

Thanks for your hint! It worked. I was missing " ".

But are the double quotes for creating space between the words only. I thought that space is created on the Mad Lib words by leaving some backspace before closing of the double quote.


#4

hi there, anything surrounded by quotes is a string.
space is part of the string if surrounded by quotes space counts in determining string length
=>"" this is an empty string hence string length is 0
=>" " this is a string with space hence string length is 1
=> "abc123" this is string with a characters string length is 6
=> "abc xyz" this string contains space and other characters, hence string length is 7.

so this problem can also be solved by adding space in the string containing very at start like " very" , so:

var result = "My" +" " + myAdjective + " " + myNoun + " " + myVerb  + " very" + myAdverb + ".";

I hope this makes it clear :slightly_smiling_face:


#5

That is a double space.


#6

Oh yeah I mistyped that. thank you for the correction. I will edit that.