Basic JavaScript - Word Blanks

Tell us what’s happening:
Describe your issue in detail here.

i have tried this multiple times. this is the second time i post this question. the first time I failed at uploading the code… hopefully this works, but it doesn’t represent the three different methods in which I successfully outputted the correct code with the sentence completed with spaces correct, etc. But no matter where I place the spaces or don’t or if I use the actual word provided for the variable or if I use the myVerb etc to call it out… i simply don’t understand what the machine is asking for.

anybody have a different way of explaining this that can make sense?

Your code so far

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

// Only change code below this line
const wordBlanks = "My" + " " + "dog" + " " + "the" + " " + "big" + " " + "idiot" + " " + "ran" + " " + "very" + " " + "quickly" + "."; // Change this line
// Only change code above this line

console.log(wordBlanks);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Word Blanks

Link to the challenge:

1 Like

Hello.

In this step you must built a string with the concatenation of words and variables.

In your code, you don´t use the variables.

I see (in your other post) you use the variables with quotation marks. Remove them. The variables don´t wear them.

I give to you an example:

const name= "AniZaTo";
const newWord = "Hello " + name;

If you do a console.log(newWord) the result will be: Hello AniZaTo

Review the example. Check your code.

Grets.

I have tried inputting the code several ways.

Neither of them seem to be working, despite me using the console.log(wordBlanks); code and having the sentence appear cohesive in several ways, but I always get an error. It never is the same error, so I can’t figure out what I am doing wrong.

PROVIDED VARIABLES:

const myNoun = “dog”;

const myAdjective = “big”;

const myVerb = “ran”;

const myAdverb = “quickly”;

EXAMPLE 1:

const wordBlanks = "My " + “dog” + " the " + “big” + " idiot " + “ran” + " very " + “quickly” + “.”;

RESULT 1:
// running tests You should not directly use the values

dog

,

ran

,

big

, or

quickly

to create

wordBlanks

. // tests completed // console output My dog the big idiot ran very quickly.

EXAMPLE 2:

const wordBlanks = "My " + “myNoun” + " the " + “myAdjective” + " idiot " + “myVerb” + " very " + “myAdverb” + “.”;

RESULT 2:
// running tests

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 of your choice). // tests completed // console output My myNoun the myAdjective idiot myVerb very myAdverb.

EXAMPLE 3

const wordBlanks = “My” + " " + “dog” + " " + “the” + " " + “big” + " " + “idiot” + " " + “ran” + " " + “very” + " " + “quickly” + “.”;

RESULT 3:

// running tests You should not directly use the values

dog

,

ran

,

big

, or

quickly

to create

wordBlanks

. // tests completed // console output My dog the big idiot ran very quickly.

  • make use of “variables” for this string manipulation
  • hint: look for “variable” that is defined already and can be replaced instead of “hard code”, for instance word “dog” can be replaced by a variable!!

happy learning :slight_smile:

1 Like

Example 2 is the correct approach, but look at the result.

You need spaces between words, and don’t put quotes “” on variables. “Quotes” mean it’s a string and will be printed literally.

var word = "Test";
console.log("word");

Output: word

var word = "Test";
console.log(word);

Output: Test

THIS! thanks. Sometimes I have a hard time understanding with the explanations they give.

Thanks to everybody who helped!
I love this community!!

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