Storing Values Javascript

Have been away for a few weeks and forgotten most of what i have learnt about javascript.

what am i doing wrong here?

Its saying do not change code above line (tick)
A should have a value of 7 (tick)
B should have a value of 7 (tick)
a should be assigned to b with = (wrong)

Your code so far


// Setup
var a;
var b = 2;

// Only change code below this line
var b = a = 7;

Your browser information:

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

  1. You can’t stack multiple assignments in a line that way.
  2. b has already been declared with the var keyword, so it is incorrect to do it again.

if b is now the same as 2, how do you make a = 2

but its saying the value is right if i do it this way? how do i get the value to 7 then?

the code above is not my code its part of the lesson as it says above do not change this code so how do i get it to the value of 7 for a and b

read it again. it says ONLY change the code below this line

In the setup portion, the variable a is declared, and no value is assigned to it (that means its value is undefined). The variable b is declared and assigned the value 2. You need to update the values of a and b according to the challenge requirements.

yes thats what im saying clearly my code is what is below the line…

Assign the value 7 to variable a .

Assign the contents of a to variable b .

thats what its wanting me to do

javascript annoys me alot.

How do you assign a value to a variable?