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) Making Decisions with Conditional Statements The Conditional Challenge Solution

Mike Aquan-Assee
Mike Aquan-Assee
15,336 Points

Challenge solution

in this example: correct += 1;

What does the += mean?

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

The way I remember it is that something is equal to something... but now I want to ADD something to it. Like Rydavim said, it can be used to increment a value, but can also be used to add to a string.

list = "blue"

list += "car"

Now... list = "bluecar"

rydavim
rydavim
18,814 Points

It's a shorthand, usually used for incrementing by a value.

// These two things are the same.
correct = correct + 1; 
correct += 1;