Concatenation of strings using + operator/word blanks

Please, how do I pass this challenge on word blanks in Javascript.

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

Here is my code:
var wordBlanks="The " + myAdjective + " " + myNoun + " " + myVerb + " " + myAdverb + ".";

Your browser information:

User Agent is: Mozilla/5.0 (Android 8.1.0; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0.

Challenge: Word Blanks

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

what error do you get, what tests are you not passing?

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

Thanks for the information.
I am currently on the word blanks challenge in javascript.
When I run my code, I get the error message Uncaught SyntaxError: Unexpected token ‘var’

Can you show me the full code?

can you show a screenshot of your editor?


That’s the challenge I’m trying to pass.


That’s the challenge. Please can you help write out the correct string format.

you should show the code that gives the error
this is the starting code

var myNoun="dog"
var myAdjective="big"
var myVerb="ran"
var myAdverb="quickly"
var wordBlanks = ""// Only change this line;
Here is my code:
var wordBlanks= "The " + myAdjective + " " + myNoun + " " + myVerb + " " + myAdverb + ".";
console.log(var wordBlanks)
SyntaxError: unknown: Unexpected token (7:12)

  5 | 
  6 | var wordBlanks = "The " + myAdjective + " " + myNoun + " " + myVerb + " " + myAdverb + "."; 
> 7 | console.log(var wordBlanks)
    |             ^
Please what could be wrong with my  string linkup using the + operator?
var myNoun="dog"
var myAdjective="big"
var myVerb="ran"
var myAdverb="quickly"
var wordBlanks = ""// Only change this line;
Here is my code:
var wordBlanks= "The " + myAdjective + " " + myNoun + " " + myVerb + " " + myAdverb + ".";
console.log(var wordBlanks)
SyntaxError: unknown: Unexpected token (7:12)

  5 | 
  6 | var wordBlanks = "The " + myAdjective + " " + myNoun + " " + myVerb + " " + myAdverb + "."; 
> 7 | console.log(var wordBlanks)
    |             
what could be wrong with my link up?

Why did you add var here?

1 Like

Wow, thanks a lot for the point out.