Trouble with Uninitialized Variables

Tell us what’s happening:
Not sure why I continue to receive “undefined” with the below code. It seems to work in the Google JavaScript Console.

Your code so far

var a = 6;

var b = 15;

var c = "I am a";

c + " String!";

// 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";
c + " String!";

Your browser information:

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

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

I might not be understanding the question/problem correctly, but in the Free Code Camp lesson you usually have to return something… while a browser console would show the response you are expecting without a specified return.

I realized that i need to manipulate the code at the top of the screen. I got it to work.

Thank you for your note.

Have a good day :slight_smile:

:joy: awesome, I had also just barely noticed the link you gave to the lesson itself… I should’ve been paying closer attention

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums