text.skipToContent text.skipToNavigation
  1. Home
  2. Computer Science & IT
  3. Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript

Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript, 1st edition

  • David Herman

Published by Addison-Wesley Professional (November 26th 2012) - Copyright © 2013

1st edition

Chosen format
View all
Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript

ISBN-13: 9780132902243

Includes: Unassigned

This product is not available in your country

What's included

  • Unassigned

Overview

Table of contents

Foreword xiii

Preface xv

Acknowledgments xvii

About the Author xix

 

Chapter 1: Accustoming Yourself to JavaScript 1

Item 1: Know Which JavaScript You Are Using 1

Item 2: Understand JavaScript’s Floating-Point Numbers 7

Item 3: Beware of Implicit Coercions 9

Item 4: Prefer Primitives to Object Wrappers 15

Item 5: Avoid using == with Mixed Types 16

Item 6: Learn the Limits of Semicolon Insertion 19

Item 7: Think of Strings As Sequences of 16-Bit Code Units 25

 

Chapter 2: Variable Scope 31

Item 8: Minimize Use of the Global Object 31

Item 9: Always Declare Local Variables 34

Item 10: Avoid with 35

Item 11: Get Comfortable with Closures 39

Item 12: Understand Variable Hoisting 42

Item 13: Use Immediately Invoked Function Expressions to Create Local Scopes 44

Item 14: Beware of Unportable Scoping of Named Function Expressions 47

Item 15: Beware of Unportable Scoping of Block-Local Function Declarations 50

Item 16: Avoid Creating Local Variables with eval 52

Item 17: Prefer Indirect eval to Direct eval 54

 

Chapter 3: Working with Functions 57

Item 18: Understand the Difference between Function, Method, and Constructor Calls 57

Item 19: Get Comfortable Using Higher-Order Functions 60

Item 20: Use call to Call Methods with a Custom Receiver 63

Item 21: Use apply to Call Functions with Different Numbers of Arguments 65

Item 22: Use arguments to Create Variadic Functions 67

Item 23: Never Modify the arguments Object 68

Item 24: Use a Variable to Save a Reference to arguments 70

Item 25: Use bind to Extract Methods with a Fixed Receiver 72

Item 26: Use bind to Curry Functions 74

Item 27: Prefer Closures to Strings for Encapsulating Code 75

Item 28: Avoid Relying on the toString Method of Functions 77

Item 29: Avoid Nonstandard Stack Inspection Properties 79

 

Chapter 4: Objects and Prototypes 83

Item 30: Understand the Difference between prototype, getPrototypeOf, and__proto__ 83

Item 31: Prefer Object.getPrototypeOf to __proto__ 87

Item 32: Never Modify __proto__ 88

Item 33: Make Your Constructors new-Agnostic 89

Item 34: Store Methods on Prototypes 92

Item 35: Use Closures to Store Private Data 94

Item 36: Store Instance State Only on Instance Objects 95

Item 37: Recognize the Implicit Binding of this 98

Item 38: Call Superclass Constructors from Subclass Constructors 101

Item 39: Never Reuse Superclass Property Names 105

Item 40: Avoid Inheriting from Standard Classes 106

Item 41: Treat Prototypes As an Implementation D

For teachers

All the material you need to teach your courses.

Discover teaching material