 # A should be assigned to b with =

Tell us what’s happening:
Help

a should be assigned to b with =

What?

``````a = 7; // The variable 'a' is equal to 7

var b;

b = 7; // The variable 'b' is equal to 7
```js

// Setup
var a;
var b = 2;

// Only change code below this line
var a;
a = 7; // The variable 'a' is equal to 7

var b;
b = 7; // The variable 'b' is equal to 7
``````

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

1. You should only ever use `var` once per variable, when you first create it.
2. You never assign `a` to `b`. You assign `7` to `b` twice and you assign `2` to `b` once.
1 Like
``````var a;

a = b;

Is it like this?
``````
``````I'm really sure what it wants me to do?

I thought I was assigning var a to b

thanks``````
``````var b = a = 7;
``````

I don’t know?

``````var a =7;
var b =7;
b = a;
``````

Okay, I figured it out here is an answer if anyone is struggling trying to figure out that one. I swear the easy ones are the hardest.

This passes, but is actually wrong.

The correct way to do this would have been

``````a = 7
b = a
``````

Declaring a `var` twice is poor practice.

I’m open to suggestions and I am learning from what passes. I don’t know what is considered poor practice yet, as I am new to this and wanting to learn the correct way. If I only learn what passes then, that is what I am learning unless someone tells me different.

This wasn’t a slight at you. I know a lot of these questions are being updated.

I don’t want to further confuse you, as this will be covered in the ES6 course…

`var` declares a variable globally. So there should be no need to declare the variable again to reassign the value.