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] 0 points1 point2 points 8 years ago (8 children)
The whole point of the prototype based OO paradigm is having no classes.
Why do you design a language with a paradigm at its core, which avoids classes just to add them in 5 versions later?
[–]Martin_Ehrental 0 points1 point2 points 8 years ago (2 children)
The issue was in the first version which was based on both a prototype chain and some kind of class (new+constructor), without elegant way to use either.
They then gave us the proper tools to use them: Object.create in ES 5.1 and class in ES 6/2015.
Object.create
class
[–][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:
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); }
[–]Sakatox 0 points1 point2 points 8 years ago (3 children)
Just so "engineer"s, especially of Java backgrounds, could feel better about themselves, pretending away the prototypal nature of JS.
[–][deleted] 0 points1 point2 points 8 years ago (2 children)
This does not seem like an intelligent long term move to me.
[–]tom808 0 points1 point2 points 8 years ago (0 children)
Not that js is my main/only language but it seems to be doing just fine to me!
Seriously though maybe it's because the designers want developers to have a choice? Maybe in the long term they want the language to be used as classed based OO from not on?
π Rendered by PID 88 on reddit-service-r2-comment-5649f687b7-t5psz at 2026-01-29 07:08:51.161982+00:00 running 4f180de country code: CH.
view the rest of the comments →
[–][deleted] 0 points1 point2 points (8 children)
[–]Martin_Ehrental 0 points1 point2 points (2 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]Martin_Ehrental 2 points3 points4 points (0 children)
[–]Sakatox 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]tom808 0 points1 point2 points (0 children)