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 jQuery Basics (2014) Creating a Simple Drawing Application Perform: Part 1

James Barrett
James Barrett
13,253 Points

What exactly is the color variable being used for?

Hi there,

Struggling to understand why Andrew is using the color variable. Why is it there? Everything still seems to work fine without it.

Thanks, James.

Joel Bardsley
Joel Bardsley
31,249 Points

You're right that it doesn't seem to make a difference at the moment, but further on when new features are added to the application for adding new colors and the drawing functionality itself, storing the color in a variable will become essential.

1 Answer

Joel Kraft
STAFF
Joel Kraft
Treehouse Guest Teacher

Hi James,

Did you ever find the answer to your question? As Joel Bardsley commented, the color variable will be used by the application to know what color the lines should be when the user draws on the canvas.

If it still doesn't make sense after you get to the end of the video Perform: Part 5, please let us know! We're happy to explain further.