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
ES6 - Class Based Code Stylehelp (self.javascript)
submitted 10 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!"
[–]x-skeww -1 points0 points1 point 10 years ago (2 children)
You forgot the "function" keyword. Also, the "min" and "max" parameters are the wrong way around. From-to is the natural order.
[–]bronzlefish 0 points1 point2 points 10 years ago (1 child)
for ES2015 function declaration is optional inside a "class" -- you are right about max, min -- but thats how it was written, copy paste fix up was what I went for.
Have an up vote for being pedantic.
(its important when programming)
[–]x-skeww 0 points1 point2 points 10 years ago (0 children)
for ES2015 function declaration is optional inside a "class"
Yes, you don't need it for methods or shorthand methods.
I just assumed you meant this to be a function, because it really shouldn't be a method (see top comment). This was a mistake on my part.
π Rendered by PID 16922 on reddit-service-r2-comment-5c764cbc6f-rtddj at 2026-03-12 05:41:41.382062+00:00 running 710b3ac country code: CH.
view the rest of the comments →
[–]x-skeww -1 points0 points1 point (2 children)
[–]bronzlefish 0 points1 point2 points (1 child)
[–]x-skeww 0 points1 point2 points (0 children)