68 effective ways to write high-quality JavaScript code

Source: Internet
Author: User
Tags variable scope

Brief introduction:

"Effective JavaScript: 68 effective ways to write high-quality JavaScript code" is divided into 7 chapters covering different topics of JavaScript. The 1th chapter focuses on the most basic topics, such as version, type conversion essentials, operator considerations, and semicolon limitations. The 2nd Chapter mainly explains the scope of variables, introduces some basic concepts in this area, and some best practical experiences. The 3rd chapter focuses on the use of functions, deep analytic functions, methods and classes, and teaches readers to use functions efficiently in different environments. The 4th chapter focuses on prototypes and objects, analyzes the inheritance mechanisms of JavaScript, and the best practices and principles used by prototypes and objects. The 5th chapter mainly introduces arrays and dictionaries, illustrates the use of objects as collections, and some pitfalls of using arrays and dictionaries. The 6th chapter introduces libraries and APIs, and explains how to design good API techniques to express programs clearly, concisely, and explicitly, and to improve the reusability rate. The 7th chapter is about concurrency, and discusses some of the "Convention idiomatic" javascript usage in technical terms.

Cover:
68 effective ways of writing high-quality JavaScript code
Directory:
The book Praises
Translator sequence
Order
Objective
1th Chapter Make yourself accustomed to JavaScript
1th: Understand the JavaScript version you use
2nd: Understanding the floating-point number of JavaScript
3rd: Beware of implicit casts
4th: The original type is better than the encapsulated 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: Encapsulate code using closures instead of strings
28th: Do not trust the ToString method of the Function object
29th: Avoid the use of non-standard stacks
Check Properties

Chapter 4th objects and prototypes
30th: Understanding the difference between prototype, Getprototype of 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 article:? 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

e-Book Download link: http://pan.baidu.com/s/1eSNQvS2 Extract password: Please pay attention to the lower right QR code after reply to the resource name gets

68 effective ways to write high-quality JavaScript code

Related Article

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.