[Effective JavaScript Notes] Summary of the book

Source: Internet
Author: User
Tags variable scope

This book is not for beginners, as it is said in the preface. Need a certain foundation, and have a certain coding practice, in order to well understand the content of the book.
学习一门编程语言,需要熟悉它的语法、形式和结构,这样才会编写合法的、符合语义的、具有意义和行为正确的程序。
The purpose of this book is to deepen understanding of how to use JS effectively to build more predictable, reliable and maintainable JS applications and libraries. All chapters are carried out around these pieces.

Directory 1th Let yourself get used to JavaScript
    • 1th: Understand the JS version you use

    • 2nd: Understanding the floating-point number of JavaScript

    • 3rd: Beware of implicit casts

    • 4th: Prototype type is better than closed object

    • 5th: Avoid using the = = Operator for mixed types

    • 6th: Understanding the limitations of semicolon insertion

    • 7th: Sequence of code elements with a 16-bit view string

2nd Chapter Variable Scope
    • 8th: Use as few global objects as possible

    • 9th: Always declare local variables

    • 10th: Avoid using with

    • 11th: Master Closure

    • 12th: Understanding Variable Declaration Promotion

    • 13th: Creating a local scope with an immediately called function expression

    • 14th: Beware of naming function expressions clumsy scopes

    • 15th: Beware of local block function declarations awkward scopes

    • 16th: Avoid using eval to create local variables

    • 17th: An indirect call to the Eval function is better than a direct call

The 3rd chapter uses the function
    • 18th: Understanding the differences between function calls, method calls, and constructor calls

    • 19th: Master high-order functions

    • 20th: Use the call method to customize the recipient to invoke the method

    • 21st: Use the Apply method to call the function with different number of parameters

    • 22nd: Use arguments to create a variable parameter function

    • 23rd: Never modify the arguments object

    • 24th: Use variables to save arguments references

    • 25th: Using the Bind method to extract a method with a definite receiver

    • 26th: Using the Bind method to implement the function currying

    • 27th: Enclosing code using closures instead of strings

    • 28th: Do not trust the ToString method of the Function object

    • 29th: Avoid using non-standard stack check properties

Chapter 4th objects and prototypes
    • 30th: Understanding the difference between prototype, getprototypeof, and __proto__

    • 31st: Use the object.getprototypeof function instead of the __proto__ property

    • 32nd: Always do not modify the __proto__ property

    • 33rd: Make the constructor independent of the new operator

    • 34th: Storing methods in prototypes

    • 35th: Use closures to store private data

    • 36th: Store the instance state only in the instance object

    • 37th: Recognize the implicit binding problem of this variable

    • 38th: Call the constructor of the parent class in the constructor of the subclass

    • 39th: Do not reuse the property name of the parent class

    • 40th: Avoid inheriting the standard class

    • 41st: See prototypes as implementation details

    • 42nd: Avoid using rash monkey patches

5th chapter Arrays and Dictionaries
    • 43rd: Construct a lightweight dictionary using a direct instance of object

    • 44th: Use NULL prototypes to prevent prototype contamination

    • 45th: Use the hasOwnProperty method to avoid prototype contamination

    • 46th: Use arrays instead of dictionaries to store ordered collections

    • 47th: Never add an enumerable property to the Object.prototype

    • 48th: Avoid modifying objects during enumeration

    • 49th: Array iterations should prefer a for loop instead of a for...in loop

    • 50th: Iterative methods are better than loops

    • 51st: Reusing a common array method on a class array object

    • 52nd: Array literals are better than array constructors

6th Chapter Library and API design
    • 53rd: To maintain a consistent agreement

    • 54th: Undefined as "no value"

    • 55th: The option object that receives the keyword parameter

    • 56th: Avoid unnecessary state

    • 57th: Design flexible interfaces using structural types

    • 58th: Distinguish between array objects and class array objects

    • 59th: Avoid excessive forced conversions

    • 60th: Support Method Chain

7th Chapter Concurrency
    • 61st: Do not block the I/O event queue

    • 62nd: Using nested or named callback functions in an asynchronous sequence

    • 63rd: Beware of discarding errors

    • 64th: Recursive use of asynchronous loops

    • 65th: Do not block the event queue when calculating

    • 66th: Use counters to perform parallel operations

    • 67th: Never call an asynchronous callback function synchronously

    • 68th: Clean asynchronous logic with promise mode

Core language-related data types

Data types and conversions. png

Function

Functions and their scopes. png

Objects and prototypes

[Effective JavaScript Notes] Summary of the book

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.