From d09c010408c0545556538299d1f96689b161642b Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 09:39:45 +0800 Subject: [PATCH 01/23] Update task.md --- .../04-array/10-maximal-subarray/task.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/1-js/05-data-types/04-array/10-maximal-subarray/task.md b/1-js/05-data-types/04-array/10-maximal-subarray/task.md index 686d0d1758..a8f5922335 100644 --- a/1-js/05-data-types/04-array/10-maximal-subarray/task.md +++ b/1-js/05-data-types/04-array/10-maximal-subarray/task.md @@ -13,12 +13,12 @@ importance: 2 例如: ```js -getMaxSubSum([-1, *!*2, 3*/!*, -9]) = 5(高亮项的加和) -getMaxSubSum([*!*2, -1, 2, 3*/!*, -9]) = 6 -getMaxSubSum([-1, 2, 3, -9, *!*11*/!*]) = 11 -getMaxSubSum([-2, -1, *!*1, 2*/!*]) = 3 -getMaxSubSum([*!*100*/!*, -9, 2, -3, 5]) = 100 -getMaxSubSum([*!*1, 2, 3*/!*]) = 6(所有项的和) +getMaxSubSum([-1, *!*2, 3*/!*, -9]) == 5(高亮项的加和) +getMaxSubSum([*!*2, -1, 2, 3*/!*, -9]) == 6 +getMaxSubSum([-1, 2, 3, -9, *!*11*/!*]) == 11 +getMaxSubSum([-2, -1, *!*1, 2*/!*]) == 3 +getMaxSubSum([*!*100*/!*, -9, 2, -3, 5]) == 100 +getMaxSubSum([*!*1, 2, 3*/!*]) == 6(所有项的和) ``` 如果所有项都是负数,那就一个项也不取(子数组是空的),所以返回的是 0: From 76a6e653e5b5ead45a4149ca5bedc17eaf03118f Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 09:47:50 +0800 Subject: [PATCH 02/23] Update to [Feb 19] --- 1-js/02-first-steps/02-structure/article.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/1-js/02-first-steps/02-structure/article.md b/1-js/02-first-steps/02-structure/article.md index 6bc757eb5c..a3c1321fa6 100644 --- a/1-js/02-first-steps/02-structure/article.md +++ b/1-js/02-first-steps/02-structure/article.md @@ -72,7 +72,6 @@ alert("There will be an error") 现在,如果我们运行代码,只有第一个 `alert` 语句的内容被显示了出来,随后我们收到了一个错误! 但是,如果我们在第一个 `alert` 语句末尾加上一个分号,就工作正常了: - ```js run alert("All fine now"); @@ -137,7 +136,7 @@ alert('World'); ``` ```smart header="使用热键!" -在大多数的编辑器中,一行代码可以使用 `key:Ctrl+/` 热键进行单行注释,诸如 `key:Ctrl+Shift+/` 的热键可以进行多行注释(选择代码,然后按下热键)。对于 Mac 电脑,应使用 `key:Cmd` 而不是 `key:Ctrl`。 +在大多数的编辑器中,一行代码可以使用 `key:Ctrl+/` 热键进行单行注释,诸如 `key:Ctrl+Shift+/` 的热键可以进行多行注释(选择代码,然后按下热键)。对于 Mac 电脑,应使用 `key:Cmd` 而不是 `key:Ctrl`,使用 `key:Option` 而不是 `key:Shift`。 ``` ````warn header="不支持注释嵌套!" From aa2075e5a764f9b2bd18968ad92fffccc6a50871 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 09:50:34 +0800 Subject: [PATCH 03/23] Update to [Dec 1] --- 1-js/02-first-steps/03-strict-mode/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/03-strict-mode/article.md b/1-js/02-first-steps/03-strict-mode/article.md index 3e3c615e4d..b45d8ac468 100644 --- a/1-js/02-first-steps/03-strict-mode/article.md +++ b/1-js/02-first-steps/03-strict-mode/article.md @@ -43,7 +43,7 @@ alert("some code"); ```warn header="没有办法取消 `use strict`" 没有类似于 `"no use strict"` 这样的指令可以使程序返回默认模式。 -一旦进入了严格模式,就没有退路了。 +一旦进入了严格模式,就没有回头路了。 ``` ## 浏览器控制台 From 882ec8e7ed67fcbb93402b2a1c7bdb8b9ebdee60 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 09:56:01 +0800 Subject: [PATCH 04/23] Update to [Dec 1] --- 1-js/02-first-steps/05-types/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index 9a3000461a..af82b7b9b3 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -121,7 +121,7 @@ alert( "the result is ${1 + 2}" ); // the result is ${1 + 2}(使用双引号 我们会在 一节中学习字符串的更多细节。 ```smart header="JavaScript 中没有 *character* 类型。" -在一些语言中,单个字符有一个特殊的 “character” 类型,在 C 语言和 Java 语言中被称为 "char"。 +在一些语言中,单个字符有一个特殊的 "character" 类型,在 C 语言和 Java 语言中被称为 "char"。 在 JavaScript 中没有这种类型。只有一种 `string` 类型,一个字符串可以包含一个或多个字符。 ``` From f13e1b2f374f39dab266c4aa6c30b319ded99f9d Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 09:57:26 +0800 Subject: [PATCH 05/23] Delete task.md --- .../1-primitive-conversions-questions/task.md | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/task.md diff --git a/1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/task.md b/1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/task.md deleted file mode 100644 index 3bd73f0d8d..0000000000 --- a/1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/task.md +++ /dev/null @@ -1,27 +0,0 @@ -importance: 5 - ---- - -# 类型转换 - -下面这些表达式的结果是什么? - -```js no-beautify -"" + 1 + 0 -"" - 1 + 0 -true + false -6 / "3" -"2" * "3" -4 + 5 + "px" -"$" + 4 + 5 -"4" - 2 -"4px" - 2 -7 / 0 -" -9 " + 5 -" -9 " - 5 -null + 1 -undefined + 1 -" \t \n" - 2 -``` - -好好思考一下,把它们写下来然后和答案比较一下。 From 245a01120199468ef4c24131b6d5f7e561a6286b Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 09:57:36 +0800 Subject: [PATCH 06/23] Delete solution.md --- .../solution.md | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/solution.md diff --git a/1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/solution.md b/1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/solution.md deleted file mode 100644 index 6a905be31b..0000000000 --- a/1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/solution.md +++ /dev/null @@ -1,26 +0,0 @@ - -```js no-beautify -"" + 1 + 0 = "10" // (1) -"" - 1 + 0 = -1 // (2) -true + false = 1 -6 / "3" = 2 -"2" * "3" = 6 -4 + 5 + "px" = "9px" -"$" + 4 + 5 = "$45" -"4" - 2 = 2 -"4px" - 2 = NaN -7 / 0 = Infinity -" -9 " + 5 = " -9 5" // (3) -" -9 " - 5 = -14 // (4) -null + 1 = 1 // (5) -undefined + 1 = NaN // (6) -" \t \n" - 2 = -2 // (7) -``` - -1. 有字符串的加法 `"" + 1`,首先会将数字 `1` 转换为一个字符串:`"" + 1 = "1"`,然后我们得到 `"1" + 0`,再次应用同样的规则得到最终的结果。 -2. 减法 `-`(就像大多数数学操作那样)只能用于数字,它会使空字符串 `""` 转换为 `0`。 -3. 带字符串的加法会将数字 `5` 加到字符串之后。 -4. 减法始终将字符串转换为数字,因此它会使 `" -9 "` 转换为数字 `-9`(忽略了字符串首尾的空格)。 -5. `null` 经过数字转换之后会变为 `0`。 -6. `undefined` 经过数字转换之后会变为 `NaN`。 -7. 字符串转换为数字时,会忽略字符串的开头和结尾处的空格字符。在这里,整个字符串由空格字符组成,包括 `\t`、`\n` 以及它们之间的“常规”空格。因此,类似于空字符串,所以会变为 `0`。 From dcdd426b358aaecc0b90b6d63ba29432e362fd43 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 10:20:47 +0800 Subject: [PATCH 07/23] Update to [Dec 3] --- .../06-type-conversions/article.md | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/1-js/02-first-steps/06-type-conversions/article.md b/1-js/02-first-steps/06-type-conversions/article.md index 3ca775ebd2..eb89c95698 100644 --- a/1-js/02-first-steps/06-type-conversions/article.md +++ b/1-js/02-first-steps/06-type-conversions/article.md @@ -70,8 +70,6 @@ number 类型转换规则: |true 和 false | `1` and `0` | | `string` | 去掉首尾空格后的纯数字字符串中含有的数字。如果剩余字符串为空,则转换结果为 `0`。否则,将会从剩余字符串中“读取”数字。当类型转换出现 error 时返回 `NaN`。 | -> 译注:字符串转换为 number 类型时,除了 `undefined`、`null` 和 `boolean` 三种特殊情况,只有字符串是由空格和数字组成时,才能转换成功,否则会出现 error 返回 `NaN`。 - 例子: ```js run @@ -81,20 +79,9 @@ alert( Number(true) ); // 1 alert( Number(false) ); // 0 ``` -请注意 `null` 和 `undefined` 在这有点不同:`null` 变成数字 `0`,`undefined` 变成 `NaN`。 - -````smart header="加号 '+' 连接字符串" -几乎所有的算术运算符都将值转换为数字进行运算,加号 `+` 运算符是个例外。如果其中一个运算元是字符串,则另一个也会被转换为字符串。 +请注意 `null` 和 `undefined` 在这有点不同:`null` 变成数字 `0`,`undefined` 变成 `NaN`。(译注:此外,字符串转换为 number 类型时,除了 `undefined`、`null` 和 `boolean` 三种特殊情况,只有字符串是由空格和数字组成时,才能转换成功,否则会出现 error 返回 `NaN`。) -然后,将两者连接在一起: - -```js run -alert( 1 + '2' ); // '12' (字符串在加号右边) -alert( '1' + 2 ); // '12' (字符串在加号左边) -``` - -这仅仅发生在至少其中一方为字符串的情况下。否则值会被转换为数字。 -```` +大多数数学运算符也执行这种转换,我们将在下一节中进行介绍。 ## 布尔型转换 From a0f6e7588ce388b0a898e33ed7e03aca159fc583 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 10:22:37 +0800 Subject: [PATCH 08/23] Update to [Feb 12] --- 1-js/02-first-steps/07-operators/article.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/1-js/02-first-steps/07-operators/article.md b/1-js/02-first-steps/07-operators/article.md index cf6f3e3de6..49ac8d764a 100644 --- a/1-js/02-first-steps/07-operators/article.md +++ b/1-js/02-first-steps/07-operators/article.md @@ -138,10 +138,10 @@ alert( +apples + +oranges ); // 5 | 优先级 | 名称 | 符号 | |------------|------|------| | ... | ... | ... | -| 16 | 一元加号 | `+` | -| 16 | 一元负号 | `-` | -| 14 | 乘号 | `*` | -| 14 | 除号 | `/` | +| 17 | 一元加号 | `+` | +| 17 | 一元负号 | `-` | +| 15 | 乘号 | `*` | +| 15 | 除号 | `/` | | 13 | 加号 | `+` | | 13 | 减号 | `-` | | ... | ... | ... | From f34ade116a990216dd422545a0c2fd2678b8d0de Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 10:23:45 +0800 Subject: [PATCH 09/23] Add files via upload --- .../solution.md | 26 ++++++++++++++++++ .../3-primitive-conversions-questions/task.md | 27 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 1-js/02-first-steps/07-operators/3-primitive-conversions-questions/solution.md create mode 100644 1-js/02-first-steps/07-operators/3-primitive-conversions-questions/task.md diff --git a/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/solution.md b/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/solution.md new file mode 100644 index 0000000000..6a905be31b --- /dev/null +++ b/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/solution.md @@ -0,0 +1,26 @@ + +```js no-beautify +"" + 1 + 0 = "10" // (1) +"" - 1 + 0 = -1 // (2) +true + false = 1 +6 / "3" = 2 +"2" * "3" = 6 +4 + 5 + "px" = "9px" +"$" + 4 + 5 = "$45" +"4" - 2 = 2 +"4px" - 2 = NaN +7 / 0 = Infinity +" -9 " + 5 = " -9 5" // (3) +" -9 " - 5 = -14 // (4) +null + 1 = 1 // (5) +undefined + 1 = NaN // (6) +" \t \n" - 2 = -2 // (7) +``` + +1. 有字符串的加法 `"" + 1`,首先会将数字 `1` 转换为一个字符串:`"" + 1 = "1"`,然后我们得到 `"1" + 0`,再次应用同样的规则得到最终的结果。 +2. 减法 `-`(就像大多数数学操作那样)只能用于数字,它会使空字符串 `""` 转换为 `0`。 +3. 带字符串的加法会将数字 `5` 加到字符串之后。 +4. 减法始终将字符串转换为数字,因此它会使 `" -9 "` 转换为数字 `-9`(忽略了字符串首尾的空格)。 +5. `null` 经过数字转换之后会变为 `0`。 +6. `undefined` 经过数字转换之后会变为 `NaN`。 +7. 字符串转换为数字时,会忽略字符串的开头和结尾处的空格字符。在这里,整个字符串由空格字符组成,包括 `\t`、`\n` 以及它们之间的“常规”空格。因此,类似于空字符串,所以会变为 `0`。 diff --git a/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/task.md b/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/task.md new file mode 100644 index 0000000000..3bd73f0d8d --- /dev/null +++ b/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/task.md @@ -0,0 +1,27 @@ +importance: 5 + +--- + +# 类型转换 + +下面这些表达式的结果是什么? + +```js no-beautify +"" + 1 + 0 +"" - 1 + 0 +true + false +6 / "3" +"2" * "3" +4 + 5 + "px" +"$" + 4 + 5 +"4" - 2 +"4px" - 2 +7 / 0 +" -9 " + 5 +" -9 " - 5 +null + 1 +undefined + 1 +" \t \n" - 2 +``` + +好好思考一下,把它们写下来然后和答案比较一下。 From 65865f2fcbdea8d8d20070e81c124707d9cdc9f8 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 10:35:36 +0800 Subject: [PATCH 10/23] Update to [Dec 3, 2019] --- .../3-primitive-conversions-questions/solution.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/solution.md b/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/solution.md index 6a905be31b..ed7f029b13 100644 --- a/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/solution.md +++ b/1-js/02-first-steps/07-operators/3-primitive-conversions-questions/solution.md @@ -18,9 +18,9 @@ undefined + 1 = NaN // (6) ``` 1. 有字符串的加法 `"" + 1`,首先会将数字 `1` 转换为一个字符串:`"" + 1 = "1"`,然后我们得到 `"1" + 0`,再次应用同样的规则得到最终的结果。 -2. 减法 `-`(就像大多数数学操作那样)只能用于数字,它会使空字符串 `""` 转换为 `0`。 +2. 减法 `-`(像大多数数学运算一样)只能用于数字,它会使空字符串 `""` 转换为 `0`。 3. 带字符串的加法会将数字 `5` 加到字符串之后。 4. 减法始终将字符串转换为数字,因此它会使 `" -9 "` 转换为数字 `-9`(忽略了字符串首尾的空格)。 5. `null` 经过数字转换之后会变为 `0`。 6. `undefined` 经过数字转换之后会变为 `NaN`。 -7. 字符串转换为数字时,会忽略字符串的开头和结尾处的空格字符。在这里,整个字符串由空格字符组成,包括 `\t`、`\n` 以及它们之间的“常规”空格。因此,类似于空字符串,所以会变为 `0`。 +7. 字符串转换为数字时,会忽略字符串的首尾处的空格字符。在这里,整个字符串由空格字符组成,包括 `\t`、`\n` 以及它们之间的“常规”空格。因此,类似于空字符串,所以会变为 `0`。 From f6ddabf959fb29efdd9090a654212a25f314a68d Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 10:39:39 +0800 Subject: [PATCH 11/23] Update to [Dec 2, 2019] --- .../08-comparison/1-comparison-questions/solution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/08-comparison/1-comparison-questions/solution.md b/1-js/02-first-steps/08-comparison/1-comparison-questions/solution.md index 035ea1c567..121cb9caef 100644 --- a/1-js/02-first-steps/08-comparison/1-comparison-questions/solution.md +++ b/1-js/02-first-steps/08-comparison/1-comparison-questions/solution.md @@ -12,7 +12,7 @@ null === +"\n0\n" → false 结果的原因: 1. 数字间比较大小,显然得 true。 -2. 按词典顺序比较,得 false。 +2. 按词典顺序比较,得 false。`"a"` 比 `"p"` 小。 3. 与第 2 题同理,首位字符 `"2"` 大于 `"1"`。 4. `null` 只与 `undefined` 互等。 5. 严格相等模式下,类型不同得 false。 From f167c89dff9c37f0b7c9c0552e05c6d5c867f9ae Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:16:29 +0800 Subject: [PATCH 12/23] Update to [Feb 19, 2020] --- 1-js/04-object-basics/01-object/article.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/1-js/04-object-basics/01-object/article.md b/1-js/04-object-basics/01-object/article.md index d71e2ae444..d2ee91be91 100644 --- a/1-js/04-object-basics/01-object/article.md +++ b/1-js/04-object-basics/01-object/article.md @@ -301,9 +301,9 @@ alert(obj.__proto__); // [object Object] — 值为对象,与预期结果不 因为用户可能会选择 `__proto__` 作为键,这个赋值的逻辑就失败了(像上面那样)。 -稍后我们将看到该问题的解决方法: -1. 我们将在 [](info:prototype-methods) 一章中了解,如何使对象将 `__proto__` 作为常规属性对待。 -2. 在 一章中还将研究另一种数据结构 [Map](info:map-set),该结构支持任意键。 +有两个解决该问题的方法: +1. 修改对象的行为,使其将 `__proto__` 作为常规属性对待。我们将在 [](info:prototype-methods) 一章中学习如何进行修改。 +2. 使用支持任意键的数据结构 [Map](info:map-set)。我们将在 章节学习它。 ## 属性存在性测试,"in" 操作符 From 9f2d0eda13379a397b861068dd0e998fa7be9ed1 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:20:32 +0800 Subject: [PATCH 13/23] Update to [Feb 11, 2020] --- 1-js/04-object-basics/03-symbol/article.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/1-js/04-object-basics/03-symbol/article.md b/1-js/04-object-basics/03-symbol/article.md index 370ef6c16d..6abcd0a282 100644 --- a/1-js/04-object-basics/03-symbol/article.md +++ b/1-js/04-object-basics/03-symbol/article.md @@ -178,22 +178,6 @@ alert( clone[id] ); // 123 这里并不矛盾,就是这样设计的。这里的想法是当我们克隆或者合并一个 object 时,通常希望 **所有** 属性被复制(包括像 `id` 这样的 Symbol)。 -````smart header="其他类型的属性键被强制为字符串" -我们只能在对象中使用字符串或 symbol 作为键,其它类型会被转换为字符串。 - -例如,在作为属性键使用时,数字 `0` 变成了字符串 `"0"`: - -```js run -let obj = { - 0: "test" // 和 "0": "test" 一样 -}; - -// 两个 alert 都访问相同的属性(Number 0 被转换为字符串 "0") -alert( obj["0"] ); // test -alert( obj[0] ); // test(同一个属性) -``` -```` - ## 全局 symbol 正如我们所看到的,通常所有的 Symbol 都是不同的,即使它们有相同的名字。但有时我们想要名字相同的 Symbol 具有相同的实体。例如,应用程序的不同部分想要访问的 Symbol `"id"` 指的是完全相同的属性。 From cd548e6e1535f220755c225d90ad83c50b3a1009 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:24:17 +0800 Subject: [PATCH 14/23] Update to [Feb 2, 2020] --- 1-js/05-data-types/03-string/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/05-data-types/03-string/article.md b/1-js/05-data-types/03-string/article.md index 4c4fc80ef8..73d22b7dd1 100644 --- a/1-js/05-data-types/03-string/article.md +++ b/1-js/05-data-types/03-string/article.md @@ -534,7 +534,7 @@ alert( str ); 因此浏览器需要知道要比较的语言。 -幸运的是,所有现代浏览器(IE10- 需要额外的库 [Intl.JS](https://github.com/andyearnshaw/Intl.js/)) 都支持国际化标准 [ECMA 402](http://www.ecma-international.org/ecma-402/1.0/ECMA-402.pdf)。 +幸运的是,所有现代浏览器(IE10- 需要额外的库 [Intl.JS](https://github.com/andyearnshaw/Intl.js/)) 都支持国际化标准 [ECMA-402](http://www.ecma-international.org/ecma-402/1.0/ECMA-402.pdf)。 它提供了一种特殊的方法来比较不同语言的字符串,遵循它们的规则。 From 9fadd4e4212e71dcc5c17fc5e39a9a0fb411bab4 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:26:34 +0800 Subject: [PATCH 15/23] Delete array-pop.svg --- 1-js/05-data-types/04-array/array-pop.svg | 69 ----------------------- 1 file changed, 69 deletions(-) delete mode 100644 1-js/05-data-types/04-array/array-pop.svg diff --git a/1-js/05-data-types/04-array/array-pop.svg b/1-js/05-data-types/04-array/array-pop.svg deleted file mode 100644 index a6e8993b73..0000000000 --- a/1-js/05-data-types/04-array/array-pop.svg +++ /dev/null @@ -1,69 +0,0 @@ - - - - array-pop.svg - Created with sketchtool. - - - - - - 0 - - - 1 - - - - 2 - - - - 3 - - - "Apple" - - - "Orange" - - - "Pear" - - - "Lemon" - - - length = 4 - - - - clear - - - - - 0 - - - 1 - - - - 2 - - - "Apple" - - - "Orange" - - - "Pear" - - - length = 3 - - - - \ No newline at end of file From 2c21eea6c10ecc0a41fb42045f18508d7c7d4d16 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:26:37 +0800 Subject: [PATCH 16/23] Delete array-shift.svg --- 1-js/05-data-types/04-array/array-shift.svg | 101 -------------------- 1 file changed, 101 deletions(-) delete mode 100644 1-js/05-data-types/04-array/array-shift.svg diff --git a/1-js/05-data-types/04-array/array-shift.svg b/1-js/05-data-types/04-array/array-shift.svg deleted file mode 100644 index 5e9705bd53..0000000000 --- a/1-js/05-data-types/04-array/array-shift.svg +++ /dev/null @@ -1,101 +0,0 @@ - - - - array-shift.svg - Created with sketchtool. - - - - 1 - - - - 2 - - - - 3 - - - "Orange" - - - "Pear" - - - "Lemon" - - - length = 4 - - - - - - 2 - - - - 3 - - - "Orange" - - - "Pear" - - - "Lemon" - - - length = 3 - - - - clear - - - move - - elements - to the left - - - - - 0 - - - "Apple" - - - - - - 0 - - - 1 - - - - 2 - - - "Orange" - - - "Pear" - - - "Lemon" - - - 1 - - - 1 - - - - \ No newline at end of file From b4a3ffac12cb8e3b2b5955f3d20280e50d72afd9 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:26:48 +0800 Subject: [PATCH 17/23] Delete array-speed.svg --- 1-js/05-data-types/04-array/array-speed.svg | 48 --------------------- 1 file changed, 48 deletions(-) delete mode 100644 1-js/05-data-types/04-array/array-speed.svg diff --git a/1-js/05-data-types/04-array/array-speed.svg b/1-js/05-data-types/04-array/array-speed.svg deleted file mode 100644 index 091f0fa52b..0000000000 --- a/1-js/05-data-types/04-array/array-speed.svg +++ /dev/null @@ -1,48 +0,0 @@ - - - - array-speed.svg - Created with sketchtool. - - - - - - 0 - - - 1 - - - - 2 - - - - 3 - - - - - pop - - - - - unshift - - - - - push - - - - - shift - - - - - - \ No newline at end of file From 95b49c6669792f5cecba54cb9233d6a9c9c39ab8 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:26:51 +0800 Subject: [PATCH 18/23] Delete queue.svg --- 1-js/05-data-types/04-array/queue.svg | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 1-js/05-data-types/04-array/queue.svg diff --git a/1-js/05-data-types/04-array/queue.svg b/1-js/05-data-types/04-array/queue.svg deleted file mode 100644 index 12c23b9364..0000000000 --- a/1-js/05-data-types/04-array/queue.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - queue.svg - Created with sketchtool. - - - - - - - - - - push - - - shift - - - - \ No newline at end of file From 35d6077135730ef2a2d33f469f8e63eb7d6aa0ca Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:26:53 +0800 Subject: [PATCH 19/23] Delete stack.svg --- 1-js/05-data-types/04-array/stack.svg | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 1-js/05-data-types/04-array/stack.svg diff --git a/1-js/05-data-types/04-array/stack.svg b/1-js/05-data-types/04-array/stack.svg deleted file mode 100644 index 6719153f71..0000000000 --- a/1-js/05-data-types/04-array/stack.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - stack.svg - Created with sketchtool. - - - - - - - - - - push - - - pop - - - - \ No newline at end of file From 38487df7c507d21e63ca7a9df9998d642b632eb9 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:27:42 +0800 Subject: [PATCH 20/23] Add files via upload --- 1-js/05-data-types/04-array/array-pop.svg | 1 + 1-js/05-data-types/04-array/array-shift.svg | 1 + 1-js/05-data-types/04-array/array-speed.svg | 1 + 1-js/05-data-types/04-array/queue.svg | 1 + 1-js/05-data-types/04-array/stack.svg | 1 + 5 files changed, 5 insertions(+) create mode 100644 1-js/05-data-types/04-array/array-pop.svg create mode 100644 1-js/05-data-types/04-array/array-shift.svg create mode 100644 1-js/05-data-types/04-array/array-speed.svg create mode 100644 1-js/05-data-types/04-array/queue.svg create mode 100644 1-js/05-data-types/04-array/stack.svg diff --git a/1-js/05-data-types/04-array/array-pop.svg b/1-js/05-data-types/04-array/array-pop.svg new file mode 100644 index 0000000000..351916051a --- /dev/null +++ b/1-js/05-data-types/04-array/array-pop.svg @@ -0,0 +1 @@ +0123"Apple""Orange""Pear""Lemon"length = 4clear012"Apple""Orange""Pear"length = 3 \ No newline at end of file diff --git a/1-js/05-data-types/04-array/array-shift.svg b/1-js/05-data-types/04-array/array-shift.svg new file mode 100644 index 0000000000..09236b9d19 --- /dev/null +++ b/1-js/05-data-types/04-array/array-shift.svg @@ -0,0 +1 @@ +123"Orange""Pear""Lemon"length = 423"Orange""Pear""Lemon"length = 3clearmove elements to the left0"Apple"012"Orange""Pear""Lemon"11 \ No newline at end of file diff --git a/1-js/05-data-types/04-array/array-speed.svg b/1-js/05-data-types/04-array/array-speed.svg new file mode 100644 index 0000000000..5660cd5ec7 --- /dev/null +++ b/1-js/05-data-types/04-array/array-speed.svg @@ -0,0 +1 @@ +0123popunshiftpushshift \ No newline at end of file diff --git a/1-js/05-data-types/04-array/queue.svg b/1-js/05-data-types/04-array/queue.svg new file mode 100644 index 0000000000..0ed2f1cd70 --- /dev/null +++ b/1-js/05-data-types/04-array/queue.svg @@ -0,0 +1 @@ +pushshift \ No newline at end of file diff --git a/1-js/05-data-types/04-array/stack.svg b/1-js/05-data-types/04-array/stack.svg new file mode 100644 index 0000000000..dcc600e714 --- /dev/null +++ b/1-js/05-data-types/04-array/stack.svg @@ -0,0 +1 @@ +pushpop \ No newline at end of file From 9929961b9f3383d6d34e6935991311852d453e09 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:30:20 +0800 Subject: [PATCH 21/23] Delete reduce.svg --- .../05-data-types/05-array-methods/reduce.svg | 64 ------------------- 1 file changed, 64 deletions(-) delete mode 100644 1-js/05-data-types/05-array-methods/reduce.svg diff --git a/1-js/05-data-types/05-array-methods/reduce.svg b/1-js/05-data-types/05-array-methods/reduce.svg deleted file mode 100644 index f77f156ccc..0000000000 --- a/1-js/05-data-types/05-array-methods/reduce.svg +++ /dev/null @@ -1,64 +0,0 @@ - - - - reduce.svg - Created with sketchtool. - - - - - 1 - - - sum - 0 - current - 1 - - - - 2 - - - sum - 0+1 - current - 2 - - - - 3 - - - sum - 0+1+2 - current - 3 - - - - 4 - - - sum - 0+1+2+3 - current - 4 - - - - 5 - - - sum - 0+1+2+3+4 - current - 5 - - - - 0+1+2+3+4+5 = 15 - - - - \ No newline at end of file From 777a7e397936bae2fb03fb7ffab3791573bfb459 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:30:51 +0800 Subject: [PATCH 22/23] Add files via upload --- 1-js/05-data-types/05-array-methods/reduce.svg | 1 + 1 file changed, 1 insertion(+) create mode 100644 1-js/05-data-types/05-array-methods/reduce.svg diff --git a/1-js/05-data-types/05-array-methods/reduce.svg b/1-js/05-data-types/05-array-methods/reduce.svg new file mode 100644 index 0000000000..fcac711cbe --- /dev/null +++ b/1-js/05-data-types/05-array-methods/reduce.svg @@ -0,0 +1 @@ +1sum 0 current 12sum 0+1 current 23sum 0+1+2 current 34sum 0+1+2+3 current 45sum 0+1+2+3+4 current 50+1+2+3+4+5 = 15 \ No newline at end of file From de0df86afda0cb6f1535fa3924247c41fbb00939 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Wed, 19 Feb 2020 11:35:02 +0800 Subject: [PATCH 23/23] Update to [Feb 19, 2020] --- 1-js/05-data-types/05-array-methods/12-reduce-object/task.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/05-data-types/05-array-methods/12-reduce-object/task.md b/1-js/05-data-types/05-array-methods/12-reduce-object/task.md index 9dfa92be11..2341364cd4 100644 --- a/1-js/05-data-types/05-array-methods/12-reduce-object/task.md +++ b/1-js/05-data-types/05-array-methods/12-reduce-object/task.md @@ -20,7 +20,7 @@ let users = [ let usersById = groupById(users); /* -// 调用函数后我们得到: +// 调用函数后,我们应该得到: usersById = { john: {id: 'john', name: "John Smith", age: 20}