question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storing Values with the Assignment Operator

See original GitHub issue

Challenge Name

Storing Values with the Assignment Operator

Issue Description

Do not change code above the line a should have a value of 7 b should have a value of 7 a should be assigned to b with =

Browser Information

In JavaScript, you can store a value in a variable with the assignment operator.

myVariable = 5;

Assigns the Number value 5 to myVariable.

Assignment always goes from right to left. Everything to the right of the = operator is resolved before the value is assigned to the variable to the left of the operator.

myVar = 5; myNum = myVar; Assigns 5 to myVar and then resolves myVar to 5 again and assigns it to myNum.

Instructions Assign the value 7 to variable a.

Assign the contents of a to variable b.

  • Browser Name, Version:
  • Operating System:
  • Mobile, Desktop, or Tablet:

Your Code

// Setup
var a;
var b = 2;

// Only change code below this line

Screenshot

image

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
vaibhavdarencommented, Jan 25, 2017

@sanjayk722 Please read the question carefully and code accordingly.The question is correct.

1reaction
tommygebrucommented, Jan 25, 2017

@sanjayk722 some challenges are tricky, and are set up to make think harder, always reread the introduction, instructions, comments, and ask for help and a second opinion in the freecodecamp chatrooms!

This challenge works, although i can understand the confusion…

Also returning the answer does not pass the challenge, because it is not specific to the instructions

for example

return c;
/*does not pass the challenge*/
Read more comments on GitHub >

github_iconTop Results From Across the Web

Storing Values with the Assignment Operator - JavaScript
Assignment always goes from right to left. Everything to the right of the = operator is resolved before the value is assigned to...
Read more >
Storing Values with the Assignment Operator | Basic JavaScript
In JavaScript, you can store a value in a variable with the assignment operator ( = ). myVariable = 5;. This assigns the...
Read more >
Storing Values With The Assignment Operator
In JavaScript, you can store a value in a variable with the assignment operator. myVariable = 5;. Assigns the Number value 5 to...
Read more >
Assignment Operators - Manual - PHP
Note that the assignment copies the original variable to the new one (assignment by value), so changes to one will not affect the...
Read more >
Assignment (=) - JavaScript - MDN Web Docs - Mozilla
The assignment (=) operator is used to assign a value to a variable. The assignment operation evaluates to the assigned value. Chaining the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found