Assigning variables help

Tell us what’s happening:
I keep getting an error. can anyone help?

Your code so far


// Setup
var a;
a = 7;
var b;

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15

Challenge: Assigning the Value of One Variable to Another

Link to the challenge:

You have a and b in the wrong order.

You want b to equal a so that is the order you need to write it in. A small, but important distinction.

so I switch the order when assigning the variables to each other? like a was declared first so it goes second?

If you declare a variable it, but don’t assign it, it does still have a value, and that value is undefined so b is undefined so when you write a = b you are reassigning a to the value of undefined.

is there something wrong with the site? im clicking the run button but nothings happening

Can I see you current code

it got fixed but now its happening again. this exercise https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition

now I cant get into the exercises at all, just a loading screen

Hello there,

If you are having issues with the platform, even when your code is correct, it is often one of these two things:

  1. Outdated browser - The safest option is the latest stable release of Google Chrome
  2. Browser Extensions - These can affect the platform, so disabling all browser extensions on the platform is advised.

Hope this helps

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.