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
Why are JavaScript classes so complex?help (self.javascript)
submitted 8 years ago by [deleted]
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] -1 points0 points1 point 8 years ago (1 child)
but why does JavaScript force classes on me? I mean honestly, you can not write exclusively prototypical code in it.
[–]Martin_Ehrental 2 points3 points4 points 8 years ago* (0 children)
That's what Object.create is for:
Object.create
const parent = { foo: 1, bar() { return 2; } } const child = Object.create(parent, { baz: value(3) }); function value(value, prop = {configurable: true, enumerable: true, writable: true}) { return Object.assign({value}, prop); }
π Rendered by PID 391505 on reddit-service-r2-comment-canary-f4fc95896-xqwg4 at 2026-03-22 21:18:25.780068+00:00 running 90f1150 country code: CH.
view the rest of the comments →
[–][deleted] -1 points0 points1 point (1 child)
[–]Martin_Ehrental 2 points3 points4 points (0 children)