Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables Review Creating and Naming Variables

tayjoh
tayjoh
2,329 Points

Complete the code below to create a variable named timeRemaining (don't assign a value to the variable).

Complete the code below to create a variable named timeRemaining (don't assign a value to the variable).

var ______ ; (fill in the blank to the left)

My answer: timeRemaining = ""

X Bummer!

Anyone know the answer? Thank you in advance =)

3 Answers

Olga DC
Olga DC
16,680 Points

You only have to declare the variable, not assign a value to it. In your code, you are assigning it a value of an empty string. You only have to write this:

var timeRemaining;

You are technically setting the variable to an empty string. If you open the console in developer tools and type in

var timeRemaining = "";
console.log(timeRemaining) 

it's going to return a blank line.

var timeRemaining;
console.log(timeRemaining)

this is going to return undefined which is what the quiz is looking for

tayjoh
tayjoh
2,329 Points

Thank you so much everyone for the quick and informative answers. I'll be sure to never make that mistake again. =)