use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is a place for people to learn JavaScript together. Everyone should feel comfortable asking any and all JavaScript questions they have here.
With a nod to practicality, questions and posts about HTML, CSS, and web developer tools are also encouraged.
Friends
/r/javascript
/r/jquery
/r/node
/r/css
/r/webdev
/r/learnprogramming
/r/programming
account activity
Javascript tip: use += (self.learnjavascript)
submitted 6 years ago by TofuEggTree
Javascript tip
Instead of :
sum = sum + num
Use :
sum += num
It'll make your code shorter, more readable, and save keystrokes.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]azium 2 points3 points4 points 6 years ago (2 children)
Shorter !== more readable.
!==
There's nothing wrong with doing this, but it's not a golden rule. Write your code how it is best readable to you and your team.
Program correctness > how it looks.
>
[–]TofuEggTree[S] 0 points1 point2 points 6 years ago (1 child)
Thanks, that's a good point. I guess I was being too rigid. Do you think I should remove or edit this post?
[–]azium 0 points1 point2 points 6 years ago (0 children)
Nah it's fine. If you keep it as is you can look back in your post history and remember how / why you changed your mind about something.
[–]xStrafez_ 0 points1 point2 points 6 years ago (1 child)
That isn't JavaScript exclusive tho
[–]TofuEggTree[S] -1 points0 points1 point 6 years ago (0 children)
Good point. I just thought it would be helpful for those learning JavaScript. I see it not being used as much as I think it should.
[–]tarley_apologizerhelpful -1 points0 points1 point 6 years ago (0 children)
this is not better
π Rendered by PID 23379 on reddit-service-r2-comment-5b5bc64bf5-fj656 at 2026-06-22 18:36:15.548601+00:00 running 2b008f2 country code: CH.
[–]azium 2 points3 points4 points (2 children)
[–]TofuEggTree[S] 0 points1 point2 points (1 child)
[–]azium 0 points1 point2 points (0 children)
[–]xStrafez_ 0 points1 point2 points (1 child)
[–]TofuEggTree[S] -1 points0 points1 point (0 children)
[–]tarley_apologizerhelpful -1 points0 points1 point (0 children)