23.04.2013 Views

javascript

javascript

javascript

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

■ CONTENTS<br />

viii<br />

Sharing a Prototype but Forgoing the Chain ...................................................................................... 163<br />

Adding an Empty Chain Link .............................................................................................................. 166<br />

Stealing a Constructor ....................................................................................................................... 169<br />

Prototypal Inheritance ................................................................................................. 171<br />

Cloning Members ........................................................................................................ 174<br />

Mixins .......................................................................................................................... 176<br />

Summary ..................................................................................................................... 179<br />

■Chapter 6: Functions and Arrays ....................................................................... 181<br />

Why Use Functions? .................................................................................................... 181<br />

Functions Are Values .................................................................................................. 183<br />

Function Members ...................................................................................................... 184<br />

Conditional Advance Loading ...................................................................................... 185<br />

Writing Object.defineProperty() .......................................................................................................... 186<br />

Writing Object.defineProperties() ....................................................................................................... 187<br />

Writing Object.create() ....................................................................................................................... 188<br />

Using the new Functions .................................................................................................................... 189<br />

Lazy Loading ............................................................................................................... 194<br />

Recursion .................................................................................................................... 198<br />

Borrowing Methods with apply() or call() .................................................................... 201<br />

Overriding toString() ........................................................................................................................... 201<br />

Testing for an Array ........................................................................................................................... 204<br />

Rewriting cloneMembers() ................................................................................................................. 206<br />

Currying ...................................................................................................................... 208<br />

Chaining Methods ....................................................................................................... 212<br />

Closure and Returning Functions ................................................................................ 216<br />

Passing a Configuration Object ................................................................................... 222<br />

Callback Functions ...................................................................................................... 223<br />

Memoization ............................................................................................................... 224

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!