From 0dc0ce36259ab410c80cb330b0874d146656068f Mon Sep 17 00:00:00 2001 From: Ariel <107245128+arielherself@users.noreply.github.com> Date: Wed, 20 Jul 2022 17:53:01 +0800 Subject: [PATCH 1/2] 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). --- 1-js/02-first-steps/07-type-conversions/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/02-first-steps/07-type-conversions/article.md b/1-js/02-first-steps/07-type-conversions/article.md index 00437d7ba2..570177a9ff 100644 --- a/1-js/02-first-steps/07-type-conversions/article.md +++ b/1-js/02-first-steps/07-type-conversions/article.md @@ -70,7 +70,7 @@ number 类型转换规则: | `undefined` | `NaN` | | `null` | `0` | |true 和 false | `1` and `0` | -| `string` | 去掉首尾空格后的纯数字字符串中含有的数字。如果剩余字符串为空,则转换结果为 `0`。否则,将会从剩余字符串中“读取”数字。当类型转换出现 error 时返回 `NaN`。 | +| `string` | 去掉首尾空白字符(空格、换行符、制表符等)后的纯数字字符串中含有的数字。如果剩余字符串为空,则转换结果为 `0`。否则,将会从剩余字符串中“读取”数字。当类型转换出现 error 时返回 `NaN`。 | 例子: @@ -130,7 +130,7 @@ alert( Boolean(" ") ); // 空格,也是 true(任何非空字符串都是 tru | `undefined` | `NaN` | | `null` | `0` | | true / false | `1 / 0` | -| `string` | “按原样读取”字符串,两端的空格会被忽略。空字符串变成 `0`。转换出错则输出 `NaN`。 | +| `string` | “按原样读取”字符串,两端的空白字符会被忽略。空字符串变成 `0`。转换出错则输出 `NaN`。 | **布尔型转换** —— 转换发生在进行逻辑操作时,也可以通过 `Boolean(value)` 进行显式转换。 From d94258be81df90849609b3011aaa5cb1e682e540 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Mon, 15 Aug 2022 18:16:34 +0800 Subject: [PATCH 2/2] chore: improve --- 1-js/02-first-steps/07-type-conversions/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/02-first-steps/07-type-conversions/article.md b/1-js/02-first-steps/07-type-conversions/article.md index 570177a9ff..07b484ecb3 100644 --- a/1-js/02-first-steps/07-type-conversions/article.md +++ b/1-js/02-first-steps/07-type-conversions/article.md @@ -70,7 +70,7 @@ number 类型转换规则: | `undefined` | `NaN` | | `null` | `0` | |true 和 false | `1` and `0` | -| `string` | 去掉首尾空白字符(空格、换行符、制表符等)后的纯数字字符串中含有的数字。如果剩余字符串为空,则转换结果为 `0`。否则,将会从剩余字符串中“读取”数字。当类型转换出现 error 时返回 `NaN`。 | +| `string` | 去掉首尾空白字符(空格、换行符 `\n`、制表符 `\t` 等)后的纯数字字符串中含有的数字。如果剩余字符串为空,则转换结果为 `0`。否则,将会从剩余字符串中“读取”数字。当类型转换出现 error 时返回 `NaN`。 | 例子: @@ -130,7 +130,7 @@ alert( Boolean(" ") ); // 空格,也是 true(任何非空字符串都是 tru | `undefined` | `NaN` | | `null` | `0` | | true / false | `1 / 0` | -| `string` | “按原样读取”字符串,两端的空白字符会被忽略。空字符串变成 `0`。转换出错则输出 `NaN`。 | +| `string` | “按原样读取”字符串,两端的空白字符(空格、换行符 `\n`、制表符 `\t` 等)会被忽略。空字符串变成 `0`。转换出错则输出 `NaN`。 | **布尔型转换** —— 转换发生在进行逻辑操作时,也可以通过 `Boolean(value)` 进行显式转换。