To be, or not to be, that is a question! :joy: 万剑归宗的无名和独霸天下的雄霸
只是看看的话,对你的帮助没有多大,你需要的是一条一条的实践;理论上,实践过下面的68个项目之后,你的JS能力应该有一个质的飞跃
==
比较是否相等 (Avoid using == with Mixed Types) eval
函数优于直接调用 (Prefer Indirect eval to Direct eval) call
方法自定义接受者来调用方法 (Use call to Call Methods with a Custom Receiver) apply
方法通过不同数量的参数调用函数 (Use apply to Call Functions with Different Numbers of Arguments) arguments
创建可变参数的函数 (Use arguments to Create Variadic Functions) arguments
对象 (Never Modify the arguments Object) arguments
的引用 (Use a Variable to Save a Reference to arguments) bind
方法提取具有确定接受者的方法 (Use bind to Extract Methods with a Fixed Receiver) bind
方法实现函数的柯里化 (Use bind to Curry Functions) toString
方法 (Avoid Relying on the toString Method of Functions) prototype
,getPrototypeOf
和__proto__
之间的不同 (Understand the Difference between prototype, getPrototypeOf, and proto) Object.getPropertyOf
函数而不要使用__proto__
属性 (Prefer Object.getPrototypeOf to proto) __proto__
属性 (Never Modify proto) new
无关 (Make Your Constructors new-Agnostic) this
变量的隐式绑定问题 (Recognize the Implicit Binding of this) Object
的直接实例构造轻量级的字典 (Build Lightweight Dictionaries from Direct Instances of Object)null
原型以防止原型污染 (Use null Prototypes to Prevent Prototype Pollution)hasOwnProperty
方法以避免原型污染 (Use hasOwnProperty to Protect Against Prototype Pollution)Object.prototype
中增加可枚举的属性 (Never Add Enumerable Properties to Object.prototype)for
循环而不是for...in
循环 (Prefer for Loops to for…in Loops for Array Iteration)undefined
看做”没有值” (Treat undefined As “No Value”) promise
模式清洁异步逻辑 (Use Promises for Cleaner Asynchronous Logic)