I need some help understanding why this simple code will not execute properly. I ran it in Vscode with quokka and it checks out. If I use the actually variable assignments there is an error not to use the actual words and if I do not use them then I get the last unchecked tasks which is to use all variable assignments. All help is much appreciated. Thanks.
Your code so far
const wordBlanks = “‘The ’ + ‘myAdjective’ + ’ myNoun’ + ‘myVerb’ + 'myAdverb ’ + ‘.’”;
const myNoun = "dog";
const myAdjective = "big";
const myVerb = "ran";
const myAdverb = "quickly";
// Only change code below this line
const wordBlanks = "'The ' + 'myAdjective' + ' myNoun' + 'myVerb' + 'myAdverb ' + '.'"; // Change this line
// Only change code above this line
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36
You have wrapped the whole thing in double quotes, so it is going to print what is literally inside those quotes. Anything that is inside quotes is just a sequence of characters and will not be treated as code.
Thanks for the quick reply so, how would I allow the code to run? Please. If I cannot use the actual variable assignment names and I don’t want to print jus the variables but the values how can I do that. I don’t want to print “myAdjective” I want to print the value of “myAdjective” which is “big” etc.
You don’t want to include strings around the variable names.
Here is an example of what you are supposed to do.
Run this example code
const firstName = 'Jessica';
const job = 'freeCodeCamp'
console.log(firstName + ' is awesome and works at ' + job + '.')
Study that example and apply that same logic to the challenge.
You don’t need to create any variables in your case, but hopefully the basic idea makes sense.
Be careful of spaces.
Hi! Cool thanks I did that but now I’m stuck on spaces because with words that I have added they are not strings already so I can wrap them and create a string and then add a space with in but for the variables that have been assigned a value I cannot wrap or else the literal variable will print out and that isn’t what I want and so I am befuddled as to how I can add spaces without being in a string and yes I tried just adding an extra space next to the variable and that didn’t work. Lol
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.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
Ok it worked. I had two spaces that is why I couldn’t see it at first. I put a space after the and then after the again and I thought it was only the one space. Like “The “ + “ “ +