Beautiful JavaScript

Book description

JavaScript is arguably the most polarizing and misunderstood programming language in the world. Many have attempted to replace it as the language of the Web, but JavaScript has survived, evolved, and thrived. Why did a language created in such hurry succeed where others failed?

This guide gives you a rare glimpse into JavaScript from people intimately familiar with it. Chapters contributed by domain experts such as Jacob Thornton, Ariya Hidayat, and Sara Chipps show what they love about their favorite language—whether it’s turning the most feared features into useful tools, or how JavaScript can be used for self-expression.

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. About This Book
    2. Conventions Used in This Book
    3. Using Code Examples
    4. Safari® Books Online
    5. How to Contact Us
  2. 1. Beautiful Mixins
    1. Classical Inheritance
    2. Prototypes
    3. Mixins
      1. The Basics
      2. The Use Case
      3. Classic Mixins
      4. The extend Function
      5. Functional Mixins
      6. Adding Options
      7. Adding Caching
      8. Advice
    4. Wrapup
  3. 2. eval and Domain-Specific Languages
    1. What About “eval Is Evil”?
    2. History and Interface
    3. Performance
    4. Common Uses
    5. A Template Compiler
    6. Speed
    7. Mixing Languages
    8. Dependencies and Scopes
    9. Debugging Generated Code
    10. Binary Pattern Matches
    11. Closing Thoughts
  4. 3. How to Draw a Bunny
    1. What Is a Rabbit?
    2. What Is a Bunny?
    3. What Does This Have to Do with JavaScript?
    4. With So Much Variation, Which Way Is Correct?
    5. How Does This Affect the Classroom?
    6. Is This Art? And Why Does That Matter?
    7. What Does This Look Like?
    8. What Did I Just Read?
  5. 4. Too Much Rope, or JavaScript for Teams
    1. Know Your Audience
    2. Stupid Good
    3. Keep It Classy
    4. Style Rules
    5. Evolution of Code
    6. Conclusion
  6. 5. Hacking JavaScript Constructors for Model Harmony
    1. Doppelgangers
    2. Miniature Models of Factories
    3. Constructor Identity Crisis
    4. Making It Scale
    5. Conclusion
  7. 6. One World, One Language
    1. An Imperative, Dynamic Proposal
    2. The Paradox of Choice
    3. Globalcommunicationscript
  8. 7. Math Expression Parser and Evaluator
    1. Lexical Analysis and Tokens
    2. Syntax Parser and Syntax Tree
    3. Tree Walker and Expression Evaluator
    4. Final Words
  9. 8. Evolution
    1. Backbone
    2. New Possibilities
  10. 9. Error Handling
    1. Assume Your Code Will Fail
      1. Throwing Errors
      2. When to Throw Errors
      3. Types of Errors
      4. Custom Errors
    2. Handling Errors
      1. Global Error Handling in Browsers
      2. Global Error Handling in Node.js
    3. Summary
  11. 10. The Node.js Event Loop
    1. Event-Driven Programming
    2. Asynchronous, Nonblocking I/O
    3. Concurrency
    4. Adding Tasks to the Event Loop
  12. 11. JavaScript Is…
    1. JavaScript Is Dynamic
    2. JavaScript Can Be Static
    3. JavaScript Is Functional
    4. JavaScript Does Everything
  13. 12. Coding Beyond Logic
    1. 0. The Basement
    2. 1. Quine’s Paradox
    3. 2. The Conjecture
    4. 3. Peer Review
  14. 13. JavaScript Is Cutieful
    1. All This Loose Beauty
    2. The Absurdity of Dalí
      1. Dalí’s JavaScript
      2. Is This Beauty Just Ugly?
      3. An Unfortunate Necessity
      4. The Beauty Is in the Madness
      5. Let’s Have a Wee Look at map
      6. Hello, thisArg
      7. Okay! So That’s a Bunch of Stuff I Already Knew About [].map—Now What?
      8. calling All Cars
      9. Number
      10. Now I Know Everything
      11. Wild
  15. 14. Functional JavaScript
    1. Functional Programming
    2. Functional JavaScript
    3. Objects
    4. Now What?
  16. 15. Progress
  17. Index

Product information

  • Title: Beautiful JavaScript
  • Author(s): Anton Kovalyov
  • Release date: August 2015
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449370756