Word Blanks - Basic JavaScript

Hi, so far up to 37 step it was all smooth and then this task pops up:

I am so lost. I feel like I am lacking some essential algorithms and functions knowledge. I’ve checked the tips for this task and a lot of people are saying that this task is not well presented. I still think I lack a lot of knowledge. But last week I finished whole HTML/CSS course with 5 projects. So I thought I could begin learning JS. Am I wrong?

The best I could do is:

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

// Only change code below this line
const wordBlanks = "sentence";
var sentence = "Neighbour saw my " + "myAdjective" + "myNoun " + "myVerb " + "very " + "myAdverb" + "."; // Change this line
// Only change code above this line

Yeah, this one confuses people a lot - especially the overall concept of the “word blank” which are basically MadLibs.

You are really close. Take a look at this:

const wordBlanks = "sentence";
var sentence = "Neighbour saw my " + "myAdjective" + ...

First of all, you only need one variable, wordBlanks. So, really, get rid of the variable sentences and just use wordBlanks.

Next, when you do "myAdjective" and put the quotes around it, JS reads that as a string literal, the letters “m”, “y”, “A”, etc., not the variable. We want the variable, so get rid of the quotes.

Lastly, it will help if you put:

console.log(wordBlanks);

at the bottom of the code. That will show you in the console window what you have created. Basically you want a combinations of string literals and variables (containing strings) concatenated together in a way that makes a coherent sentence.

With that info, give it a shot. If you still struggle, come back and we’ll try to give you a better hint.

2 Likes

I am so lost.

Don’t get frustrated. This is hard stuff. It were easy, it would pay minimum wage.

I feel like I am lacking some essential algorithms and functions knowledge.

We’re not quite to the point of algorithms or functions yet. This is more the basics of JS.

But FCC moves kind of quickly. Don’t be afraid to look up some other examples if you aren’t sure about something. And don’t be afraid to back up a few challenges and try them again. I would warn against perfectionism though - you can’t learn it all perfectly, and if you try, it will just slow you down.

This is not “easy” for anyone. Don’t assume that everyone just easily speeds though these. Everyone struggles with something - most of us struggled with several things.

But last week I finished whole HTML/CSS course with 5 projects. So I thought I could begin learning JS. Am I wrong?

No, that’s right. But JS is a different kettle of fish. It is a “real” programming language. The concepts are different. Learning HTML and CSS don’t really prepare you for JS.

But keep at it, you’ll get it. And don’t be afraid to ask the forum if you need an idea cleared up. There is no question you can ask that there aren’t at least 10 other people out there that are just too embarrassed to ask. Just ask, that’s why the forum is here.

2 Likes

@kevinSmith thank you for your concern, really helpful.
I’ve managed to get:

// Only change code below this line
const wordBlanks = "Neighbours saw my " + myAdjective ;
console.log(wordBlanks);
 // Change this line
// Only change code above this line

the reuslt is

Neighbours saw my big

Then I tried

const wordBlanks = "Neighbours saw my " + myAdjective + " " myNoun" ;

and it crashes. Now I can see I don’t now how to add another variable with space. I use

" "

as space

Ok, got it…

"Neighbours saw my " + myAdjective + " " + myNoun;

:slight_smile:

1 Like

Right, just keep building it out.

That is a really important tactic when coding - breaking big problems into smaller problems. I’m actually doing that at work right now - I have a large, multi-facetted problem that is busting my chops so I’m breaking it into little pieces and testing as I go. 10 small problems are much easier to solve than 1 big one. The trick is knowing how to break it apart, but still, it’s very useful.

1 Like

Thanks! It is very refreshing to see even advanced developers having some struggles and overcoming it. I will be asking here a lot of questions I guess.

Thanks! It is very refreshing to see even advanced developers having some struggles and overcoming it.

You…have…no…idea. Trust me, we all struggle with something. A good portion of every developer’s week is spent staring at the screen, “Wait? What? How is this not working?!?” That is usually followed at some point by, “Oh, I see now, I’m suck and idiot!”

I will be asking here a lot of questions I guess.

Good.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.