[Excerpt]: JavaScript: The Good Parts
Table of Content
- Preface
- Good Parts
- Grammer
- Objects
- Functions
- Inheritance
- Arrays
- Regular Expressions
- Methods
- Style
- Beautiful Features
Preface
Good Parts
Grammer
Objects
Functions
Function Objects
Function Literal
Invocation
Arguments
Return
Exceptions
Augmenting Types
// Add a method conditionally.
Function.prototype.method = function(name, func) {
if (!this.prototype[name]) {
this.prototype[name] = func;
return this;
}
};