Please can anyone help me out am stucked.
Mind posting the code and a link to the lesson?
var myNoun = "dog";
var myAdjective = "big";
var myVerb = "ran";
var myAdverb = "quickly";
// Only change code below this line
var wordBlanks = "dog + big + ran + quickly";
// Change this line
// Only change code above this line
You are using the wrong type of quotes. Also pay attention to the spaces they give you in the example
Did nt get you. Can you try and explain further?
Sure
Yes = "
No = “
Yes= "It was really " + "hot" + ", and we " + "laughed" + " ourselves " + "silly" + "."
No= “dog + big + ran + quickly”;
you need to use variables that are initialised at the top, and you need to use the concatenation operator +
to concatenate those variables with other stuff (remember to add spaces!)
Do you mean as below.
var myNoun = "dog";
var myAdjective = "big";
var myVerb = "ran";
var myAdverb = "quickly";
// Only change code below this line
var wordBlanks = "It was really " + "dog" + ", and we " + "big" + " ourselves " + "ran" + "quickly";
// Change this line
// Only change code above this line
you need to use the variables, not the values of the variables. Like, you need to use the variable myNoun
, it has value of "dog"
. But you need to use the variable itself when building the string, not its value.
You need to use the feature of string concatenation, using variables.
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.
Thanks for your support.
It still did not pass.
var wordBlanks="It was really " + "myNoun" + ", and we " + "myAdjective" + " ourselves " + "myVerb" + "myAdverb";
// Change this line.
See the error am getting .
// 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 in your madlib). // tests completed
please format your code.
Anyway, this time you are using strings "myNoun"
etc, which are not variables (words surrounded by quotes are not variables!)
you can see the value of your string adding as last line of your code console.log(wordBlanks)
, it will print the value of the wordBlanks
variable to the console.
It is a debugging tool, but it will be really useful to you, I am sure.