diff --git a/README.md b/README.md index eb6a241..8fa4170 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,13 @@ **只是看看的话,对你的帮助没有多大,你需要的是一条一条的实践;理论上,实践过下面的68个项目之后,你的JS能力应该有一个质的飞跃** +**:grin:如果你觉得下面有些章节的代码示例不够好,或者有问题;欢迎发`pull request`或者提`issues`,我会把它添加进来,让更多的人看到。 + 第七章节有几章节没有代码示例,也欢迎大家补充。:grin:** + + [x] Chapter 1 **Accustoming Yourself to JavaScript** - [x] [Item 1: **知道你正在使用的JavaScript模式** (Know Which JavaScript You Are Using)](chapter-1/know-which-javascript-you-are-using.md) - [x] [Item 2: **注意JavaScript的浮点数** (Understand JavaScript’s Floating-Point Numbers)](chapter-1/understand-javascript’s-floating-point-numbers.md) - - [x] [Item 3: **当心隐形的强制转换** (Beware of Implicit Coercions)](chapter-1/beware-of-implicit-coercions.md) + - [x] [Item 3: **当心隐式的强制转换** (Beware of Implicit Coercions)](chapter-1/beware-of-implicit-coercions.md) - [x] [Item 4: **使用原始类型替代对象包裹** (Prefer Primitives to Object Wrappers)](chapter-1/prefer-primitives-to-object-wrappers.md) - [x] [Item 5: **混合类型避免使用`==`比较是否相等** (Avoid using == with Mixed Types)](chapter-1/avoid-using-not-strict-equality-with-mixed-types.md) - [x] [Item 6: **学习分号的插入机制** (Learn the Limits of Semicolon Insertion)](chapter-1/learn-the-limits-of-semicolon-insertion.md) @@ -76,7 +79,7 @@ - [x] [item 65: **不要在计算时阻塞事件队列** (Don’t Block the Event Queue on Computation)](chapter-7/do-not-block-the-event-queue-on-computation.md) - [x] [item 66: **使用计数器来执行并行操作** (Use a Counter to Perform Concurrent Operations)](chapter-7/use-a-counter-to-perform-concurrent-operations.md) - [x] [item 67: **绝不要同步地调用异步的回调函数** (Never Call Asynchronous Callbacks Synchronously)](chapter-7/never-call-asynchronous-callbacks-synchronously.md) - - [x] [item 68: **(非常值得自己实践)使用`promise`模式清洁异步逻辑** (Use Promises for Cleaner Asynchronous Logic)](chapter-7/) + - [x] [item 68: **(非常值得自己实践)使用`promise`模式清洁异步逻辑** (Use Promises for Cleaner Asynchronous Logic)](chapter-7/use-promises-for-cleaner-asynchronous-logic.md) ------ @@ -97,4 +100,4 @@ - \ No newline at end of file + diff --git a/chapter-1/beware-of-implicit-coercions.md b/chapter-1/beware-of-implicit-coercions.md index 81231c6..ffb9d66 100644 --- a/chapter-1/beware-of-implicit-coercions.md +++ b/chapter-1/beware-of-implicit-coercions.md @@ -1,4 +1,4 @@ -### 当心隐形的强制转换 +### 当心隐式的强制转换 ```javascript console.log(3 + true); // 4 @@ -91,4 +91,4 @@ console.log(point()); // { x: 1, y: 1 } + `+`号运算符会根据它的参数类型来决定是做加法还是字符串的拼接。 + `Object`通过它的`toString`方法被强制转换为字符串,通过它的`valueOf`方法被强制转换为数字。 + 带有`valueOf`方法的`Object`应该实现一个`toString`方法,这个`toString`方法返回的字符串就是那个`valueOf`返回的数字的字符串表示形式。 -+ 判断一个值是否是未定义的应该使用`typeof`或者比较的方法,而不是根据这个值表现是`true`或者`false`来判断。 \ No newline at end of file ++ 判断一个值是否是未定义的应该使用`typeof`或者比较的方法,而不是根据这个值表现是`true`或者`false`来判断。 diff --git a/chapter-1/item4/demo.html b/chapter-1/item4/demo.html index 8f34e7e..9e59293 100644 --- a/chapter-1/item4/demo.html +++ b/chapter-1/item4/demo.html @@ -6,6 +6,5 @@