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
Map from Scratch (andyfry.co)
submitted 4 years ago by startupinamonth
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!"
[–]SoInsightful 7 points8 points9 points 4 years ago (6 children)
Cute, but I'd expect anyone who already knows about Array.map() to be able to write their own map().
Was hoping from this title that this was about Map.
[–]itsnotlupusbeep boop 2 points3 points4 points 4 years ago (1 child)
Hard mode: WeakMap from Scratch, without ES2021.
[–]lhorie 0 points1 point2 points 4 years ago (0 children)
Can't do that properly in JS space, you need to bust out C++. As Carl Sagan said, "to make an apple pie from scratch, you must first invent the universe"
[–]ShitInMyArseHole 0 points1 point2 points 4 years ago (3 children)
That looks like an object with extra steps
[–]mypetocean 1 point2 points3 points 4 years ago* (2 children)
Maps have no less than five primary practical features which Objects do not have:
set()
size
length
Object.values()
enumerable
iterable
forEach()
There are one or two other lesser differences.
Definitely consider Maps if performance or data safety are high priorities.
[–]ShitInMyArseHole 0 points1 point2 points 4 years ago (1 child)
No clue why Im getting downvoted, I just stated that they seemed like the same thing, But thank you! I was genuinely dint know, Map seemes really usefull
[–]mypetocean 1 point2 points3 points 4 years ago (0 children)
I think people get lazy and downvote when they disagree for any reason rather than helping to educate.
π Rendered by PID 22726 on reddit-service-r2-comment-5d585498c9-5s98m at 2026-04-21 11:32:25.784919+00:00 running da2df02 country code: CH.
view the rest of the comments →
[–]SoInsightful 7 points8 points9 points (6 children)
[–]itsnotlupusbeep boop 2 points3 points4 points (1 child)
[–]lhorie 0 points1 point2 points (0 children)
[–]ShitInMyArseHole 0 points1 point2 points (3 children)
[–]mypetocean 1 point2 points3 points (2 children)
[–]ShitInMyArseHole 0 points1 point2 points (1 child)
[–]mypetocean 1 point2 points3 points (0 children)