只是看看的话,对你的帮助没有多大,你需要的是一条一条的实践;理论上,实践过下面的68个项目之后,你的JS能力应该有一个质的飞跃
😁如果你觉得下面有些章节的代码示例不够好,或者有问题;欢迎发pull request或者提issues,我会把它添加进来,让更多的人看到。
第七章节有几章节没有代码示例,也欢迎大家补充。:grin:
-  Chapter 1 Accustoming Yourself to JavaScript
- Item 1: 知道你正在使用的JavaScript模式 (Know Which JavaScript You Are Using)
- Item 2: 注意JavaScript的浮点数 (Understand JavaScript’s Floating-Point Numbers)
- Item 3: 当心隐式的强制转换 (Beware of Implicit Coercions)
- Item 4: 使用原始类型替代对象包裹 (Prefer Primitives to Object Wrappers)
-  Item 5: 混合类型避免使用==比较是否相等 (Avoid using == with Mixed Types)
- Item 6: 学习分号的插入机制 (Learn the Limits of Semicolon Insertion)
- Item 7: 把字符串当做16位编码单元的序列 (Think of Strings As Sequences of 16-Bit Code Units)
 
-  Chapter 2 Variable Scope
- item 8: 尽量少用全局变量 (Minimize Use of the Global Object)
- item 9: 始终声明局部变量 (Always Declare Local Variables)
- item 10: 避免使用with (Avoid with)
- item 11: 熟练掌握闭包 (Get Comfortable with Closures)
- item 12: 理解变量声明提升 (Understand Variable Hoisting)
- item 13: 使用立即调用的函数表达式创建新的作用域 (Use Immediately Invoked Function Expressions to Create Local Scopes)
- item 14: 当心命名函数表达式笨拙的作用域 (Beware of Unportable Scoping of Named Function Expressions)
- item 15: 当心局部块函数声明笨拙的作用域 (Beware of Unportable Scoping of Block-Local Function Declarations)
- item 16: 避免使用eval创建局部变量 (Avoid Creating Local Variables with eval)
-  item 17: 间接调用eval函数优于直接调用 (Prefer Indirect eval to Direct eval)
 
-  Chapter 3 Working with Functions
- item 18: 理解函数调用,方法调用及构造函数调用之间的不同 (Understand the Difference between Function, Method, and Constructor Calls)
- item 19: 熟练掌握高阶函数 (Get Comfortable Using Higher-Order Functions)
-  item 20: 使用call方法自定义接受者来调用方法 (Use call to Call Methods with a Custom Receiver)
-  item 21: 使用apply方法通过不同数量的参数调用函数 (Use apply to Call Functions with Different Numbers of Arguments)
-  item 22: 使用arguments创建可变参数的函数 (Use arguments to Create Variadic Functions)
-  item 23: 永远不要修改arguments对象 (Never Modify the arguments Object)
-  item 24: 使用变量保存arguments的引用 (Use a Variable to Save a Reference to arguments)
-  item 25: 使用bind方法提取具有确定接受者的方法 (Use bind to Extract Methods with a Fixed Receiver)
-  item 26: 使用bind方法实现函数的柯里化 (Use bind to Curry Functions)
- item 27: 使用闭包而不是字符串来封装代码 (Prefer Closures to Strings for Encapsulating Code)
-  item 28: 不要信赖函数的对象的toString方法 (Avoid Relying on the toString Method of Functions)
- item 29: 避免使用非标准的栈检查属性 (Avoid Nonstandard Stack Inspection Properties)
 
-  Chapter 4 Objects and Prototypes
-  item 30: 理解prototype,getPrototypeOf和__proto__之间的不同 (Understand the Difference between prototype, getPrototypeOf, and proto)
-  item 31: 使用Object.getPropertyOf函数而不要使用__proto__属性 (Prefer Object.getPrototypeOf to proto)
-  item 32: 始终不要修改__proto__属性 (Never Modify proto)
-  item 33: 使构造函数与操作符new无关 (Make Your Constructors new-Agnostic)
- item 34: 在原型中存储方法 (Store Methods on Prototypes)
- item 35: 使用闭包存储私有数据 (Use Closures to Store Private Data)
- item 36: 只将实例状态存储在实例对象中 (Store Instance State Only on Instance Objects)
-  item 37: 认识到this变量的隐式绑定问题 (Recognize the Implicit Binding of this)
- item 38: 在子类的构造函数中调用父类的构造函数 (Call Superclass Constructors from Subclass Constructors)
- item 39: 不要重用父类的属性名 (Never Reuse Superclass Property Names)
- item 40: 避免继承标准类 (Avoid Inheriting from Standard Classes)
- item 41: 将原形视为实现的细节 (Treat Prototypes As an Implementation Detail)
- item 42: 避免使用轻率的猴子补丁 (Avoid Reckless Monkey-Patching)
 
-  item 30: 理解
-  Chapter 5 Arrays and Dictionaries
-  item 43: 使用Object的直接实例构造轻量级的字典 (Build Lightweight Dictionaries from Direct Instances of Object)
-  item 44: 使用null原型以防止原型污染 (Use null Prototypes to Prevent Prototype Pollution)
-  item 45: 使用hasOwnProperty方法以避免原型污染 (Use hasOwnProperty to Protect Against Prototype Pollution)
- item 46: 使用数组而不要使用字典来存储有序集合 (Prefer Arrays to Dictionaries for Ordered Collections)
-  item 47: 绝不要在Object.prototype中增加可枚举的属性 (Never Add Enumerable Properties to Object.prototype)
- item 48: (非常值得自己实践一下)避免在枚举期间修改对象 (Avoid Modifying an Object during Enumeration)
-  item 49: 数组迭代要优先使用for循环而不是for...in循环 (Prefer for Loops to for...in Loops for Array Iteration)
- item 50: 迭代方法优于循环 (Prefer Iteration Methods to Loops)
- item 51: 在类数组对象上复用通用的数组方法 (Reuse Generic Array Methods on Array-Like Objects)
- item 52: 数组字面量优于数组构造函数 (Prefer Array Literals to the Array Constructor)
 
-  item 43: 使用
-  Chapter 6 Library and API Design
- item 53: 保持一致的约定 (Maintain Consistent Conventions)
-  item 54: 将undefined看做"没有值" (Treat undefined As “No Value”)
- item 55: 接收关键字参数的选项对象 (Accept Options Objects for Keyword Arguments)
- item 56: 避免不必要的状态 (Avoid Unnecessary State)
- item 57: 使用结构类型设计灵活的接口 (Use Structural Typing for Flexible Interfaces)
- item 58: 区分数组对象和类数组对象 (Distinguish between Array and Array-Like)
- item 59: 避免过度的强制转换 (Avoid Excessive Coercion)
- item 60: 支持方法链 (Support Method Chaining)
 
-  Chapter 7 Concurrency
- item 61: 不要阻塞I/O事件队列 (Don’t Block the Event Queue on I/O)
- item 62: (已经不推荐使用)在异步序列中使用嵌套或命名的回调函数 (Use Nested or Named Callbacks for Asynchronous Sequencing)
- item 63: 当心丢弃错误 (Be Aware of Dropped Errors)
- item 64: 对异步的循环使用递归 (Use Recursion for Asynchronous Loops)
- item 65: 不要在计算时阻塞事件队列 (Don’t Block the Event Queue on Computation)
- item 66: 使用计数器来执行并行操作 (Use a Counter to Perform Concurrent Operations)
- item 67: 绝不要同步地调用异步的回调函数 (Never Call Asynchronous Callbacks Synchronously)
-  item 68: (非常值得自己实践)使用promise模式清洁异步逻辑 (Use Promises for Cleaner Asynchronous Logic)