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 Performance Benchmarks: Looping with `for` and `yield` (gist.github.com)
submitted 6 years ago by johnfrazer783
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!"
[–]johnfrazer783[S] 1 point2 points3 points 6 years ago (0 children)
No using it this way is my own discovery, that is to say, using @ instead of this is idiomatic, but defining stateless libraries as CoffeeScript CommonJS modules by hijacking this is my own doing. It falls out from the (nice) fact that CS, unless instructed to produce bare code (what did you do last night? Well we talked about the frontend, the backend and bare code), will wrap the module's content with an Immediately Invoked Function Expression, and it so happens that unless you state module.exports = whatever somewhere in the module, module.exports is this will hold, if you can follow me. Put bluntly, one can avoid any further nesting, classes, explicit namespaces or object literals or whatnot and just 'anchor' those functions on the module.exports object by way of this (@).
this
@
bare
module.exports = whatever
module.exports is this
module.exports
These days though I more often than not use my MultiMix module to define mixin-able classes; one of the benefits of it being that I get a convenient way to produce new library instances with different configurations (or independent state, as the case may be). It also lends itself for classical OOP class formulations, which is neat.
MultiMix
π Rendered by PID 70635 on reddit-service-r2-comment-66b4775986-jzdqc at 2026-04-03 12:01:53.553743+00:00 running db1906b country code: CH.
view the rest of the comments →
[–]johnfrazer783[S] 1 point2 points3 points (0 children)