Klaus Komenda takes us through the history of development patterns of JavaScript demonstrating the pros and cons. Taking a typical JavaScript feature he starts with the old-school global functions method and iterates through a Singleton, Module Pattern, Revealing Module Pattern, Custom Objects and Lazy Function Definitions bringing the same feature up-to-date.
Ivo Wetzel covers some of the quirks of the JavaScript language. Some of these cause subtle bugs, some overturn conventional wisdom. It covers toString on numbers. Covers the advanced JavaScript features such as prototypal inheritance, this, closures, anonymous wrappers, type-casting, automatic semicolon insertion and hoisting of function and variable declarations.
Based on Simon Willison's original 2005 eTech talk, Simon expands this into a full article covering the expressive functionality of JavaScript. He covers the basics of JavaScript: literals, variables, functions, scope, control flow, objects, classes, inner functions and closures. Everything a developer needs to know before diving into more advanced JavaScript.
Ben Cherry, web developer at Twitter, takes us step by step through the Module Pattern. He introduces the standard features of Anonymous Closures and avoiding global scope, and covers advanced concepts such as augmentation, cloning, inheritance, private state and sub-modules.
A simplified explanation of closures by Morris Johns: A closure is the local variables for a function - kept alive after the function has returned.
A stackoverflow community article explaining closures in plain simple English does a great job. Succinctly: a closure is created when inner function that gets returned. The inner function can still see the variables and methods defined in the outer function.
Douglas Crockford explains the new strict mode introduced in the 5th edition of ECMAScript. It is an opt-in mode that repairs or removes some of the language's most problematic features such as: function scoping, implied global variables and global leakage, read-only variable failures, octal defaults and function arguments.
Angus Croll takes the reader step-by-step through some basic JavaScript code explaining what 'this' is in each step and why. He explains how 'this' depends on the execution context, and how it is manipulated by how JavaScript functions are called (or applied or bound with bind), and how Constructors create a new context.
Tim Caswell describes the JavaScript variable 'this', which is about current scope and current context. The only way to create scope in JavaScript is through function definitions, and in most cases the context is the receiver of the message (the object before the dot in the method call). He also talks about approaches to controlling what this references with call, apply and bind.
Christian Heilmann lays out seven rules to better unobtrusive JavaScript, including not making assumptions about JavaScript, the browser and the document. Work with structured markup. If you are traversing a document, maybe there's a solution that can take advantage of CSS's selector mechanism instead. Work with browsers and users. Better understanding of events, and playing nice with namespace, scope, and patterns. And of course, think about the next developer, so keep the code maintainable.
Douglas Crockford's JavaScript code conventions. Covers indentation, line length, comments, variable and function declarations, minification, statements and labels, whitespace, scope and eval.
First in a series of talks from Douglas Crockford about the JavaScript language. These talks cover the JavaScript language, from the history, the language, advanced features, platforms, standards and programming style. Talks about inheritance, using functions to build objects, closures, as well as the basic JavaScript syntax. Also covers code conventions. JavaScript is a language that requires discipline.
Matt Kruse's JavaScript Toolbox presents a number of excellent best practice ideas including: using var, feature detection, when to use square bracket notation, avoiding eval, referencing forms and form elements, avoiding the with keyword, using onclick instead of JavaScript pseudo-protocol, using unary + to type convert to numbers, avoiding document.all, not using HTML comments in script blocks, avoid cluttering the global namespace, avoiding prototype.js, avoiding synch Ajax calls, using JSON and the correct way to use script tags