Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops What are Loops?

Gabrielle Coleman
Gabrielle Coleman
1,229 Points

why is it counter += 1 and not counter += +1

why is it counter += 1 and not counter += +1

Gabrielle Coleman
Gabrielle Coleman
1,229 Points

I have another unrelated question. I am on the beginner JavaScript track. I want to study in more than one track at the same time, so if I hit that 'switch' button will I be able to resume the first track whenever I want and switch back and forth? If I switch tracks will I lose the progress I made in the first track?

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You could do that but generally speaking, we don´t say "add positive one" to a number, we generally just say "add 1". The line you are referring to counter += 1 is shorthand for counter = counter + 1.

Hope this helps! :sparkles:

Gabrielle Coleman
Gabrielle Coleman
1,229 Points

Yes! Thank you. I didn't realize it was already adding the 1.

jamesjones21
jamesjones21
9,248 Points

if it is for incremental purposes we can do it like var i++; :)