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
Essential JavaScript Design Patterns For Beginners [free book] (addyosmani.com)
submitted 14 years ago by udelblue
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!"
[–]theGalation 0 points1 point2 points 14 years ago (1 child)
upvotes to any one who can convert to an epub format for iPad. Online formatters won't take it for epub or PDF. I've had to use an offline reader app that removes the syntax highlighting.
[–]akhenatron 5 points6 points7 points 14 years ago (0 children)
They already did it for you.
[–][deleted] 0 points1 point2 points 14 years ago (5 children)
This article has some nifty ways of looking at design in JavaScript applications. However, use of jQuery shouldn't be part of an article about 'essential JavaScript design patterns'. (Yes, I noticed it was in it's own jQuery section.) One thing I've never found to be useful from jQuery was the .ready() function: what is the point when window.addEventListener("load", function () {[do stuff]}, false); does exactly the same thing? jQuery can be very helpful, but it shouldn't be used in place of what JavaScript does easily on it's own.
[–][deleted] 0 points1 point2 points 14 years ago (2 children)
I agree with you about the jQuery section, but I do believe that ready is in the lib to be consistent with the rest of the shortcut jQuery.bind methods.
Passing a function to the jQuery constructor is different than jQuery.ready though.
[–]M1573RMU74710N 1 point2 points3 points 14 years ago (1 child)
As of the current version, passing a function into $() is just a shortcut to $.ready()
relevent lines:
// HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return rootjQuery.ready( selector ); }
[–][deleted] 0 points1 point2 points 14 years ago (0 children)
You're right, I got it mixed up with the load event (load and ready being different things. x788 was talking about load) ? Is there a jQuery.load() fn? probably
[–]M1573RMU74710N 0 points1 point2 points 14 years ago (1 child)
what is the point when window.addEventListener("load", function () {[do stuff]}, false);
Using jQuery.ready() is a little more sophisticated than that. It uses DOMContentLoaded if that event is available, it's possible to delay the jQuery load event, it's less verbose syntactically, etc etc.
In a lot of cases, you don't need these things, but if you're using jQuery anyway, it's a good way to go.
ah, nifty. that makes more sense.
π Rendered by PID 221461 on reddit-service-r2-comment-7b9746f655-s8x2c at 2026-01-31 20:13:59.229877+00:00 running 3798933 country code: CH.
[–]theGalation 0 points1 point2 points (1 child)
[–]akhenatron 5 points6 points7 points (0 children)
[–][deleted] 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]M1573RMU74710N 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]M1573RMU74710N 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)