Did exact what shown in the help video but still can run this code

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

Your code so far


var myName = "roger";


Your browser information:

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

Challenge: Declare JavaScript Variables

Link to the challenge:

That is valid JS but you actually did more than was asked:

You should declare myName with the var keyword, ending with a semicolon

You not only declared it, but you initialized it too.

// declaring a variable:
var myVar1;

// declaring and initializing with a value:
var myVar2 = 123;

You were supposed to only declare it, not initialize it. (I assume they’ll cover that next or soon.)

When I remove the initialization, your code passes for me.

1 Like

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