Storing Values with the Assignment Operator 9999

Storing Values with the Assignment Operator 9999
0.0 0

#1

Tell us what’s happening:
I don’t get it. how do I Assign the contents of a to variable b.

Your code so far


// Setup
var a;
var b = 2;

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


Your browser information:

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

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


#2

Hi @lmfaoizzy,

To solve the example you should know important things:

firstly: what is variable? a variable is a place in memory where you can store data in.

Secondly: how to assign value to variable? by put the variable name in the left of equal operator and the value you want to store it in the right of equal operator.

Here is the rule:
Variable name = assign value you want to store temporary

var data = 5; //this mean that you put 5 in the data variable

If you stuck, here is the solution of answer try to understand what i wrote it from the solution:

// Setup
var a;
var b = 2;

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

Hope this help you to understand and solve the example, good luck and have a happy coding.

Regards,
Ali Mosaad


#3

Instead of the line ‘var a= var b;’ use
a = b;

Hope this helps!