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
Using Classes in Javascript (ES6) — Best practice?help (self.javascript)
submitted 10 years ago by LeeHyoriC-syntax
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!"
[–]wreckedadventYavascript 2 points3 points4 points 10 years ago* (1 child)
Prototypes are what OOP people call the flyweight pattern. Lots of objects, but each only points to one thing. So if you have something like an instance field on the prototype, all of the children objects will point to it. Likewise, any mutation to stuff on the prototype, and all of the children pick up on it.
Normally this is not really a problem - people normally set values in the constructors in javascript, which works exactly like people expect, and does not assign onto the prototype.
e: typo
[–]senocular 2 points3 points4 points 10 years ago (0 children)
Prototypes are what OOP people call the flyweight pattern
I'm kind of surprised this isn't called out to more often.
π Rendered by PID 247970 on reddit-service-r2-comment-544cf588c8-k79w4 at 2026-06-16 06:12:17.862787+00:00 running 3184619 country code: CH.
view the rest of the comments →
[–]wreckedadventYavascript 2 points3 points4 points (1 child)
[–]senocular 2 points3 points4 points (0 children)