Understanding Uninitialized Variables challange

Tell us what’s happening:
Hi guys I have struggles with my code…so make sure if Im doing wel ? please help!!!

Your code so far


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

// Do not change code below this line

a = a + 6;
b = b + 15;
c = c + " String!";

Your browser information:

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

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

You have to assign values to the variables declared above so that the statements below all make sense.

1 Like

Hello! Initialization is an important programming concept. It refers to having a system in a perfectly known state (at least at the beginning!).
It helps you in avoiding some errors due to variables holding an unexpected value (Or no value at all for hardware systems like the Nintendo Entertainment System)
To initialize a variable, assign it any value! An example would be:

function travelTime() {
  var distance = 0;
  var speed = 0;
  /*...*/
  return distance/speed;
}

After the second line, distance is said to be “initialized”. The same goes for speed after the third line.

1 Like