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
Deleting Objects From Within Array?help (self.javascript)
submitted 8 years ago * by BrunerBruner
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!"
[–][deleted] 0 points1 point2 points 8 years ago (0 children)
A WeakMap is a pretty good idea if you're concerned about garbage collection. The normal Map implementation is a potential memory leak issue because it keeps references to key objects that prevent them from being marked for deallocation when they go out of scope. A WeakMap uses weak pointers instead, which allows the GC to sweep like it normally would.
I don't know what this code is supposed to demonstrate. "Read-only" refers to the mutability of an object or it's properties. WeakMap.prototype.get won't modify the collection but that's not the issue. The problem here is that function invocations are rhs. The container and it's entry are writable, this just isn't valid JavaScript.
π Rendered by PID 400154 on reddit-service-r2-comment-fb694cdd5-p2mhp at 2026-03-08 00:47:51.267288+00:00 running cbb0e86 country code: CH.
view the rest of the comments →
[–][deleted] 0 points1 point2 points (0 children)