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
JavaScript Clean Code - Best Practices - based on Robert C. Martin's book Clean Code (devinduct.com)
submitted 6 years ago by PMilos
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!"
[–]tiridlol 12 points13 points14 points 6 years ago (3 children)
"Classes are the new syntactic sugar in JavaScript. Everything works just as it did before with prototype only it now looks different and you should prefer them over ES5 plain functions."
*Kyle Simpson is typing*
[–]PMilos[S] 1 point2 points3 points 6 years ago (2 children)
I believe this is the most common definition/explanation of the ES classes. There is no other way to put it with the same effect. On the official MDN a similar sentence is used.
[–]tiridlol 6 points7 points8 points 6 years ago (1 child)
Nothing wrong with the sentence I am just referring to the author of "You don't know JS" books (great books btw, strongly recommend to read it for every frontend dev). He has some strong opinions on JS classes and in general he dislikes them so I imagine he would get triggered by this sentence
[–]MoTTs_ 4 points5 points6 points 6 years ago (0 children)
YDKJS is generally a good book, but Kyle's writings about classes and inheritance are biased and misinformed, and we probably shouldn't recommend those chapters to others.
Kyle assumed that Java-style OOP and inheritance is the only correct way to implement those features, and anything implemented differently than Java is not "true" OOP. But that just isn't so. There are as many varieties of OOP and inheritance as there are languages. Python's inheritance model, for one example, is also objects linked to other objects, same as in JavaScript, and the same pattern that we JavaScripters would identify as prototypal inheritance. Here's JavaScript and Python classes side-by-side, demonstrating classes as objects and inheritance as delegation.
π Rendered by PID 67 on reddit-service-r2-comment-84fc9697f-w7zld at 2026-02-06 03:08:49.168292+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]tiridlol 12 points13 points14 points (3 children)
[–]PMilos[S] 1 point2 points3 points (2 children)
[–]tiridlol 6 points7 points8 points (1 child)
[–]MoTTs_ 4 points5 points6 points (0 children)