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 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,260 Points

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