Video description
"Essential reading for developers of any discipline ... with powerful techniques to improve your JavaScript."
Becky Huett, Big Shovel Labs
More than ever, the web is a universal platform for all types of applications, and JavaScript is the language of the web. If you're serious about web development, it's not enough to be a decent JavaScript coder. You need to be ninja-stealthy, efficient, and ready for anything. This Video Edition book shows you how.
Secrets of the JavaScript Ninja, Second Edition uses practical examples to clearly illustrate each core concept and technique. This completely revised edition shows you how to master key JavaScript concepts such as functions, closures, objects, prototypes, and promises. It covers APIs such as the DOM, events, and timers. You'll discover best practice techniques such as testing and cross-browser development, all taught from the perspective of skilled JavaScript practitioners.
Inside:
- Writing more effective code with functions, objects, and closures
- Learning to avoid JavaScript application pitfalls
- Using regular expressions to write succinct text-processing code
- Managing asynchronous code with promises
- Fully revised to cover concepts from ES6 and ES7
You don't have to be a ninja to read this book—just be willing to become one. Are you ready?
John Resig is an acknowledged JavaScript authority and the creator of the jQuery library. Bear Bibeault is a web developer and author of the first edition, as well as coauthor of Ajax in Practice, Prototype and Scriptaculous in Action, and jQuery in Action from Manning. Josip Maras is a post-doctoral researcher and teacher.
Excellent and comprehensive insight into the magic of functions and closures for the efficient use of JavaScript.
Gerd Klevesaat, Siemens
The essential resource for moving your JavaScript skills to the next level.
David Starkey, Blum
Helps you master both the stealthy and bold techniques of modern JavaScript.
Christopher Haupt, New Relic Inc.
Table of Contents
PART 1: WARMING UP
Chapter 1. JavaScript is everywhere
Chapter 1. How will JavaScript evolve?
Chapter 1. Understanding the browser
Chapter 1. Boosting skill transferability
Chapter 2. Building the page at runtime
Chapter 2. The page-building phase
Chapter 2. Executing JavaScript code
Chapter 2. Event handling
Chapter 2. Registering event handlers
PART 2: UNDERSTANDING FUNCTIONS
Chapter 3. First-class functions for the novice: definitions and arguments
Chapter 3. Callback functions
Chapter 3. Fun with functions as objects
Chapter 3. Defining functions
Chapter 3. Function declarations and function expressions
Chapter 3. Arrow functions
Chapter 3. Arguments and function parameters
Chapter 3. Summary
Chapter 4. Functions for the journeyman: understanding function invocation
Chapter 4. The arguments parameter
Chapter 4. Invoking functions
Chapter 4. Invocation as a constructor
Chapter 4. Invocation with the apply and call methods
Chapter 4. Fixing the problem of function contexts
Chapter 5. Functions for the master: closures and scopes
Chapter 5. Putting closures to work
Chapter 5. Tracking code execution with execution contexts
Chapter 5. Keeping track of identifiers with lexical environments
Chapter 5. Understanding types of JavaScript variables
Chapter 5. Variable definition keywords and lexical environments
Chapter 5. Registering identifiers within lexical environments
Chapter 5. Exploring how closures work
Chapter 5. Summary
Chapter 6. Functions for the future: generators and promises
Chapter 6. Working with generator functions
Chapter 6. Using generators
Chapter 6. Communicating with a generator
Chapter 6. Exploring generators under the hood
Chapter 6. Working with promises
Chapter 6. Diving into promises
Chapter 6. Creating our first real-world promise
Chapter 6. Combining generators and promises
Chapter 6. Summary
PART 3: DIGGING INTO OBJECTS FORTIFYING YOUR CODE
Chapter 7. Object orientation with prototypes
Chapter 7. Object construction and prototypes
Chapter 7. Side effects of the dynamic nature of JavaScript
Chapter 7. Achieving inheritance
Chapter 7. The problem of overriding the constructor property
Chapter 7. The instanceof operator
Chapter 7. Using JavaScript “classes” in ES6
Chapter 7. Implementing inheritance
Chapter 8. Controlling access to objects
Chapter 8. Defining getters and setters
Chapter 8. Using getters and setters to validate property values
Chapter 8. Using proxies to control access
Chapter 8. Using proxies for logging
Chapter 8. Using proxies to implement negative array indexes
Chapter 9. Dealing with collections
Chapter 9. Adding and removing items at either end of an array
Chapter 9. Common operations on arrays
Chapter 9. Reusing built-in array functions
Chapter 9. Maps
Chapter 9 . Creating our first map
Chapter 9. Union of sets
Chapter 10. Wrangling regular expressions
Chapter 10. A regular expression refresher
Chapter 10. Terms and operators
Chapter 10. Compiling regular expressions
Chapter 10. Capturing matching segments
Chapter 10. Replacing using functions
Chapter 10. Solving common problems with regular expressions
Chapter 11. Code modularization techniques
Chapter 11. Using objects, closures, and immediate functions to specify modules
Chapter 11. Modularizing JavaScript applications with AMD and CommonJS
Chapter 11. ES6 modules
Chapter 11. Summary
PART 4: BROWSER RECONAISSANCE
Chapter 12. Working the DOM
Chapter 12. Converting HTML to DOM
Chapter 12. Using DOM attributes and properties
Chapter 12. Styling attribute headaches
Chapter 12. Fetching computed styles
Chapter 12. Measuring heights and widths
Chapter 12. Minimizing layout thrashing
Chapter 13. Surviving events
Chapter 13. An example with only macrotasks
Chapter 13. An example with both macro- and microtasks
Chapter 13. Taming timers: time-outs and intervals
Chapter 13. Timer execution within the event loop
Chapter 13. Dealing with computationally expensive processing
Chapter 13. Working with events
Chapter 13. Propagating events through the DOM
Chapter 13. Custom events
Chapter 14. Developing cross-browser strategies
Chapter 14. The five major development concerns
Chapter 14. External code and markup
Chapter 14. Regressions
Chapter 14. Implementation strategies
Chapter 14. Untestable browser issues
Chapter 14. Reducing assumptions