Skip to content

Commit d7b4550

Browse files
fix: a factual mistake on space characters and whitespace characters (#1084)
* fix a factual mistake on space characters and whitespace characters code with respect to the modification has been verified on Node.js (latest version by now). * chore: improve Co-authored-by: LeviDing <imdingxuewen@gmail.com>
1 parent ba6eefe commit d7b4550

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

1-js/02-first-steps/07-type-conversions/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ number 类型转换规则:
7070
| `undefined` | `NaN` |
7171
| `null` | `0` |
7272
|<code>true&nbsp;&nbsp;false</code> | `1` and `0` |
73-
| `string` | 去掉首尾空格后的纯数字字符串中含有的数字。如果剩余字符串为空,则转换结果为 `0`。否则,将会从剩余字符串中“读取”数字。当类型转换出现 error 时返回 `NaN`|
73+
| `string` | 去掉首尾空白字符(空格、换行符 `\n`、制表符 `\t` 等)后的纯数字字符串中含有的数字。如果剩余字符串为空,则转换结果为 `0`。否则,将会从剩余字符串中“读取”数字。当类型转换出现 error 时返回 `NaN`|
7474

7575
例子:
7676

@@ -130,7 +130,7 @@ alert( Boolean(" ") ); // 空格,也是 true(任何非空字符串都是 tru
130130
| `undefined` | `NaN` |
131131
| `null` | `0` |
132132
| <code>true&nbsp;/&nbsp;false</code> | `1 / 0` |
133-
| `string` | “按原样读取”字符串,两端的空格会被忽略。空字符串变成 `0`。转换出错则输出 `NaN`。 |
133+
| `string` | “按原样读取”字符串,两端的空白字符(空格、换行符 `\n`、制表符 `\t` 等)会被忽略。空字符串变成 `0`。转换出错则输出 `NaN`。 |
134134
135135
**布尔型转换** —— 转换发生在进行逻辑操作时,也可以通过 `Boolean(value)` 进行显式转换。
136136

0 commit comments

Comments
 (0)