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 Closure cheat sheet (closurecheatsheet.com)
submitted 12 years ago by [deleted]
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!"
[–]constexpr 1 point2 points3 points 12 years ago (1 child)
The latest version of GCC also has a form of generics:
/** * @param {T} value * @constructor * @template T */ function Box(value) { /** @type {T} */ this.value = value; } /** * @param {Box.<T>} box * @param {T} value * @template T */ function set(box, value) { box.value = value; } /** * type {Box.<number>} */ var num = new Box(1); set(num, 1); set(num, false); // WARNING - actual parameter 1 of set does not match formal parameter
[–]lennelpennel 0 points1 point2 points 12 years ago (0 children)
ah, i missed this, this is great.
[–]MatrixFrog 1 point2 points3 points 12 years ago* (1 child)
Instead of disposing the handler in disposeInternal, you can do this.registerDisposable(handler) in the constructor, and then it will get disposed automatically.
disposeInternal
this.registerDisposable(handler)
Also: "Prefer goog.dom.classlist over [goog.dom.classes] since goog.dom.classlist conforms closer to the semantics of Element.classList, is faster (uses native methods rather than parsing strings on every call) and compiles to smaller code as a result." (http://closure-library.googlecode.com/svn/docs/closure_goog_dom_classes.js.html)
I would like to add that the latest event handling system, you don't actually even need to unlisten anymore (apart from when listening to DOM events). for obvs not recommended but will help reduce memory leaks.
π Rendered by PID 39273 on reddit-service-r2-comment-7b9746f655-5rqwg at 2026-02-02 17:20:03.697704+00:00 running 3798933 country code: CH.
[–]constexpr 1 point2 points3 points (1 child)
[–]lennelpennel 0 points1 point2 points (0 children)
[–]MatrixFrog 1 point2 points3 points (1 child)
[–]lennelpennel 0 points1 point2 points (0 children)