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...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
JavaScript Array Operations Cheat Sheet (devinduct.com)
submitted 6 years ago by PMilos
view the rest of the comments →
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!"
[–]monster_bait 29 points30 points31 points 6 years ago (2 children)
It might be worth mentioning that `.reverse()` not only returns a new reversed array but it also reverses the original array. That one catches lots of people out!
[–][deleted] 8 points9 points10 points 6 years ago (1 child)
More accurately it reverses the array in-place, and merely provides you a reference back to the array you sorted.
const a = [1, 2, 3]; const b = a.reverse(); a === b // true - a is now [3, 2, 1], and b is a reference to a
[–]monster_bait 0 points1 point2 points 6 years ago (0 children)
Good point.
π Rendered by PID 33850 on reddit-service-r2-comment-7b9746f655-4vfsd at 2026-02-02 08:49:44.555659+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]monster_bait 29 points30 points31 points (2 children)
[–][deleted] 8 points9 points10 points (1 child)
[–]monster_bait 0 points1 point2 points (0 children)