Needing help with Word Blanks challenge (expert basic)

Tell us what’s happening:
im stuck on the challenge ‘Word Blanks’.

Instructions say this:
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).

but also this:
You should not directly use the values “dog”, “ran”, “big”, or “quickly” to create word Blanks .

I’m about ready to give up on java as much as i’m interested in learning it but this stuff has me ripping my eyes out , I’ve come across a couple of things now where the system sort of expects you to know what to do, i can honestly say i’m totally new to coding so there’s not a hope in hell i’ll know the answer.
Any help would be great, thanks people.
p.s @FreeCodeCamp, keep up the great work.

Your code so far


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

var wordBlanks = 'The' + myAdjective + myNoun + myVerb + myAdverb; // Only change this line;

Challenge: Word Blanks

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

Below is my code now, below that are the instructions.

CODE

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

var wordBlanks= 'the' + myAdjective + '' + myNoun +'' + myVerb + '' + myAdverb; // Only change this line;``

INSTRUCTIONS/RULES
1: wordBlanks should be a string.
Passed

2: You should not change the values assigned to myNoun , myVerb , myAdjective or myAdverb .
Passed

3: You should not directly use the values “dog”, “ran”, “big”, or “quickly” to create wordBlanks .
Passed

4: 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).
Failed

var wordBlanks='the ' +myAdjective+ '' +myNoun+ '' +myVerb+ '' +myAdverb;`

i have put spaces

Mind that a space in the code, is different from a space in a sentence, programming wise.
So you have to be mindful of everything that stays inside quotes, since the program will treat it as a string.

Let’s have a look at your latest example:

var wordBlanks='the ' +myAdjective+ '' +myNoun+ '' +myVerb+ '' +myAdverb;`
'the '  // words "the" followed by a space  
myAdjective // string variable
'' // empty string: there's no character inside here.
myNoun  // string variable
'' // empty string: there's no character inside here.
myVerb  // string variable
''  // empty string: there's no character inside here.
myAdverb  // string variable

As you can see there are many instances where there is no space.
Just be aware of the difference between

'' // empty open/close quotes
' ' // there is a space character in between quotes

Hope this helps :+1:

2 Likes

Why didn’t someone mention it like that an hour ago, simple mistake on my behalf but where would we be if we didn’t make mistakes ey.
Thanks very much @Marmiz
also @camperextraordinaire

1 Like