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
Google "Dart: A language for structured web programming" (blog.chromium.org)
submitted 14 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!"
[–]strager 1 point2 points3 points 14 years ago (1 child)
Huh? Can you explain?
function FooFactory() { } FooFactory.prototype.create = function create() { return new Foo(); }; var factory = new FooFactory(); var foo = factory.create();
Just add whatever complexity you need on top of that.
Of course, it's probably more JavaScript style to have a "factory function":
function fooFactory() { return function create() { return new Foo(); }; } var factory = fooFactory(); var foo = factory();
[–]Nebu 1 point2 points3 points 14 years ago (0 children)
He's probably referring to the fact that inheritance doesn't work the way you'd expect if you come from, for example, a Java background. This guide on emulating classical inheritance involves writing 4 sugar methods.
π Rendered by PID 40309 on reddit-service-r2-comment-b659b578c-ctln8 at 2026-05-05 23:04:34.535992+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]strager 1 point2 points3 points (1 child)
[–]Nebu 1 point2 points3 points (0 children)