Understanding Undefined variables

Tell us what’s happening:
please how can I answer the question correctly by initializing the variables so that they are not undefined?

Your code so far


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

var a = 4 + 1;
var b = 9 + 1;
var c = 15; "I am a string!";


// Do not change code below this line

a = a + 1;
b = b + 5;
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/75.0.3770.142 Safari/537.36.

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

The var keyword should only be used once per variable. This is when the variable is initialized. You are doing it twice.

Hi @virtuoushands, in addition to what @ArielLeslie wrote, there is an error here concerning the string:

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

If you want to compare your solution to others, use the Get a hint button on the challenge and there are alternative solutions you can compare yours to. Also, you can probably search older posts using the forum search feature or google the challenge name and find more there.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Thank you for understanding.

1 Like

Good day dear sirs @ ArieLeslie, Md_Hasan , simonebogni , ieahleen and thank you for the timely and helpful replies. I will work on getting the correct answer to the question and also put to consideration the need to not post my full working solution so as not to add to the number of spoiler solutions found on the forum as explained by ieahleen. I understand sir.