Initializing Variables with the Assignment Operator help me please

Initializing Variables with the Assignment Operator help me please
0

Tell us what’s happening:

Your code so far


// Example
var ourVar = 19;

// Only change code below this line
var num = 9; //

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator

the instructions say:

Define a variable a with var and initialize it to a value of 9.

And here is what you wrote:

You’ve followed most of the instruction correctly. The only problem is that you have not used the correct name for the variable. Your new variable is called ‘num’ but the instructions say “Define a variable a”
So just fix that and it should work.

1 Like

It is common to initialize a variable to an initial value in the same line as it is declared.

`var myVar = 0;`

Creates a new variable called myVar and assigns it an initial value of 0 .
is the same as
create a new variable called a and assigns it an initial value of 9 .
so it becomes

var a = 9;