Understanding Uninitialized Variables help

Understanding Uninitialized Variables help
0

#1

Pls someone tell me what is wrong here? :confused:

Your code so far


// Initialize these three variables
var a;
var b;
var c;

// Do not change code below this line

a = a + 1;
b = b + 5;
c = c + " String!";
var a= 6;
var b= 15;
var c= "I am a";

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables/


#2

You are changing the code below the line, change only above the line. That will make you not pass the challenge even with the right answer

Also, var is used only the first time the variable appear, not following times.

Right now a = a + 1 is undefined because previously a doesnโ€™t have a value, and that gives an error (you are saying that a is equal to undefined + 1), try assigning a value to your variables before using them

Code is used top to bottom so even if you assign a value to a later, in that line a is undefined