From 2cc848e40544cc75708fcb5c3399c1e6c25de6d3 Mon Sep 17 00:00:00 2001 From: doepy <8428487+doepy@user.noreply.gitee.com> Date: Sun, 16 May 2021 17:09:05 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=96=B0=E5=BB=BA=203=E7=8F=AD=5F=E9=99=B6?= =?UTF-8?q?=E5=86=B6=5F=E7=AC=AC=E5=8D=81=E4=B9=9D=E5=91=A8=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/.keep" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/.keep" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/.keep" new file mode 100644 index 00000000..e69de29b -- Gitee From 92a7adaefe7c7129c5e0f2b313e6b008ceca9fb4 Mon Sep 17 00:00:00 2001 From: doepy <8428487+doepy@user.noreply.gitee.com> Date: Sun, 16 May 2021 17:09:22 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=96=B0=E5=BB=BA=203=E7=8F=AD=5F=E9=99=B6?= =?UTF-8?q?=E5=86=B6=5F=E7=AC=AC=E5=8D=81=E4=B9=9D=E5=91=A8=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=5F1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_1/.keep" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_1/.keep" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_1/.keep" new file mode 100644 index 00000000..e69de29b -- Gitee From 07c08787b00f129f479d35d37907f81a76907745 Mon Sep 17 00:00:00 2001 From: doepy <8428487+doepy@user.noreply.gitee.com> Date: Sun, 16 May 2021 17:09:36 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=96=B0=E5=BB=BA=203=E7=8F=AD=5F=E9=99=B6?= =?UTF-8?q?=E5=86=B6=5F=E7=AC=AC=E4=B9=9D=E5=91=A8=E4=BD=9C=E4=B8=9A=5F2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_2/.keep" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_2/.keep" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_2/.keep" new file mode 100644 index 00000000..e69de29b -- Gitee From bff0943a76744f9ba23add90a12fabb7d1424228 Mon Sep 17 00:00:00 2001 From: doepy <8428487+doepy@user.noreply.gitee.com> Date: Sun, 16 May 2021 17:09:46 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=96=B0=E5=BB=BA=203=E7=8F=AD=5F=E9=99=B6?= =?UTF-8?q?=E5=86=B6=5F=E7=AC=AC=E4=B9=9D=E5=91=A8=E4=BD=9C=E4=B8=9A=5F3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_3/.keep" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_3/.keep" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_3/.keep" new file mode 100644 index 00000000..e69de29b -- Gitee From 8aaba8e5670012190af7d6e55595a27d61ddd3ac Mon Sep 17 00:00:00 2001 From: doepy <8428487+doepy@user.noreply.gitee.com> Date: Sun, 16 May 2021 17:11:39 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20=E7=AC=AC?= =?UTF-8?q?=E4=BA=8C=E6=9C=9F=E8=AE=AD=E7=BB=83=E8=90=A5/3=E7=8F=AD/3?= =?UTF-8?q?=E7=8F=AD=5F=E9=99=B6=E5=86=B6/3=E7=8F=AD=5F=E9=99=B6=E5=86=B6?= =?UTF-8?q?=5F=E7=AC=AC=E5=8D=81=E4=B9=9D=E5=91=A8=E4=BD=9C=E4=B8=9A/3?= =?UTF-8?q?=E7=8F=AD=5F=E9=99=B6=E5=86=B6=5F=E7=AC=AC=E4=B9=9D=E5=91=A8?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=5F3=20=E4=B8=BA=20=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E6=9C=9F=E8=AE=AD=E7=BB=83=E8=90=A5/3=E7=8F=AD/3=E7=8F=AD=5F?= =?UTF-8?q?=E9=99=B6=E5=86=B6/3=E7=8F=AD=5F=E9=99=B6=E5=86=B6=5F=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E4=B9=9D=E5=91=A8=E4=BD=9C=E4=B8=9A/3=E7=8F=AD=5F?= =?UTF-8?q?=E9=99=B6=E5=86=B6=5F=E7=AC=AC=E5=8D=81=E4=B9=9D=E5=91=A8?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=5F3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_3/.keep" => "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_3/.keep" (100%) diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_3/.keep" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_3/.keep" similarity index 100% rename from "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_3/.keep" rename to "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_3/.keep" -- Gitee From 1cc9da2fb86f23997519b40ca1ea29f4666ec8a5 Mon Sep 17 00:00:00 2001 From: doepy <8428487+doepy@user.noreply.gitee.com> Date: Sun, 16 May 2021 17:11:50 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20=E7=AC=AC?= =?UTF-8?q?=E4=BA=8C=E6=9C=9F=E8=AE=AD=E7=BB=83=E8=90=A5/3=E7=8F=AD/3?= =?UTF-8?q?=E7=8F=AD=5F=E9=99=B6=E5=86=B6/3=E7=8F=AD=5F=E9=99=B6=E5=86=B6?= =?UTF-8?q?=5F=E7=AC=AC=E5=8D=81=E4=B9=9D=E5=91=A8=E4=BD=9C=E4=B8=9A/3?= =?UTF-8?q?=E7=8F=AD=5F=E9=99=B6=E5=86=B6=5F=E7=AC=AC=E4=B9=9D=E5=91=A8?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=5F2=20=E4=B8=BA=20=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E6=9C=9F=E8=AE=AD=E7=BB=83=E8=90=A5/3=E7=8F=AD/3=E7=8F=AD=5F?= =?UTF-8?q?=E9=99=B6=E5=86=B6/3=E7=8F=AD=5F=E9=99=B6=E5=86=B6=5F=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E4=B9=9D=E5=91=A8=E4=BD=9C=E4=B8=9A/3=E7=8F=AD=5F?= =?UTF-8?q?=E9=99=B6=E5=86=B6=5F=E7=AC=AC=E5=8D=81=E4=B9=9D=E5=91=A8?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=5F2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_2/.keep" => "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_2/.keep" (100%) diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_2/.keep" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_2/.keep" similarity index 100% rename from "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232_2/.keep" rename to "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_2/.keep" -- Gitee From 5157a17f57ce738e447495bf0e68f0de525f63c9 Mon Sep 17 00:00:00 2001 From: doepy <8428487+doepy@user.noreply.gitee.com> Date: Sun, 16 May 2021 17:12:11 +0800 Subject: [PATCH 7/9] =?UTF-8?q?3=E7=8F=AD=5F=E9=99=B6=E5=86=B6=5F=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E4=B9=9D=E5=91=A8=E4=BD=9C=E4=B8=9A=203=E7=8F=AD=5F?= =?UTF-8?q?=E9=99=B6=E5=86=B6=5F=E7=AC=AC=E5=8D=81=E4=B9=9D=E5=91=A8?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../week19_1pra.js" | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_1/week19_1pra.js" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_1/week19_1pra.js" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_1/week19_1pra.js" new file mode 100644 index 00000000..783bc667 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_1/week19_1pra.js" @@ -0,0 +1,96 @@ +//循环语句: for循环,while循环 +for(let i=0; i<20; i++){ + console.log(i) +} + +const MAX_TIMES =20; +let cur = 0 +while (cur < MAX_TIMES){ + cur++; + console.log(cur) +} +// for in 遍历对象的属性 +let myObj = {a: 1, b: 2, c: 3, d: 4} +for (let e in myObj){ + console.log(e, myObj[e]); +} +//for of 遍历可迭代对象的元素 +let myArray = [1, 2, 3, 4, 5] +for (let e of myArray){ + console.log(e) +} +// forEach 常用 +let myArray = [1, 2, 3, 4, 5] +myArray.forEach(function (e : number)){ + console.log(e * e); +}) +// do while +const MAX_TIMES = 20; +let cur = 0 + +do { + cur ++; + console.log(cur); +}while (cur < MAX_TIMES) + + +//条件语句 +for(let i=0; i,100; i++) { + if (i % 2 === 0){ + consol.log("偶数", i) + } else if (i < 0) { + console.log("负数不判断") + }else{ + console.log("奇数", i) + } +} +/*逻辑运算符 +== +=== 等于 +! 逻辑取反 +&& and + || or +*/ +//选择语句 +function foo(arg){ + switch (arg){ + case 'a': + console.log(arg, 1); + break; + case 'b': + console.log(arg, 2); + break; + case 'c': + consloe.log(arg, 3); + break; + default: + console.log('default') + } +} +foo('e') +//异常处理 +function foo(){ + try{ + throw TypeError('test'); + }catch (e){ + console.log('Error' e); + }finally { + console.log('Done') + } +} + + +function foo(){ + try{ + throw TypeError('test'); + }catch (e) { + if (e instanceof TypeError) { + console.log("TypeError") + } else { + console.log('Error', e); + } + }finally{ + console.log('Done!') + } +} +//抛出异常 -- Gitee From c7b7e3a695d16c94b07c7245fea46c373e616d95 Mon Sep 17 00:00:00 2001 From: doepy <8428487+doepy@user.noreply.gitee.com> Date: Sun, 16 May 2021 17:12:25 +0800 Subject: [PATCH 8/9] =?UTF-8?q?3=E7=8F=AD=5F=E9=99=B6=E5=86=B6=5F=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E4=B9=9D=E5=91=A8=E4=BD=9C=E4=B8=9A=203=E7=8F=AD=5F?= =?UTF-8?q?=E9=99=B6=E5=86=B6=5F=E7=AC=AC=E5=8D=81=E4=B9=9D=E5=91=A8?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../week19_2pra.js" | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_2/week19_2pra.js" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_2/week19_2pra.js" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_2/week19_2pra.js" new file mode 100644 index 00000000..619d8c1f --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_2/week19_2pra.js" @@ -0,0 +1,165 @@ +/* +第十九周第二节课练习 +一,对象和类 +二,构造函数和this +三,原型式继承 + */ +// 对象和类 +class Rectangle { + constructor(height, width) { + this.name = 'rectangle'; + this.height = height; + this.width = width; + } + + +} + +let rectangle = new Rectangle(2,5); +console.log(rectangle) + +//实例方法 +class Rectangle { + constructor(height, width) { + this.name = 'rectangle'; + this.height = height; + this.width = width; + } + + getArea(){ + return this.height * this.width; + } +} + +//静态方法 +class Rectangle { + constructor(height, width) { + this.name = 'rectangle'; + this.height = height; + this.width = width; + } + + getArea(){ + return this.height * this.width; + } + + static staticMethod(){ + console.log("calling static method") + } +} +// getter 和 setter +class Rectangle { + constructor(height, width) { + this.name = 'rectangle'; + this.height = height; + this.width = width; + } + + getArea(){ + return this.height * this.width; + } + + static staticMethod(){ + console.log("calling static method") + } + get area(){ + return this.getArea() + } + + set area(value){ + this._value = value + } +} + +//类继承 +class Rectangle { + constructor(height, width) { + this.name = 'rectangle'; + this.height = height; + this.width = width; + } + + getArea(){ + return this.height * this.width; + } + + static staticMethod(){ + console.log("calling static method") + } + get area(){ + return this.getArea() + } + + set area(value){ + this._value = value + } +} + +class Square extends Rectangle { + constructor(a) { + super(a, a); + this.name = 'sqaure' + } +} + +let suqare = new Square(10) +console.log(suqare.area) + + +//构造函数和this +function Rectangle(height, width){ + this.name = 'rectangle'; + this.width = width; + this.height = height; + + this.getArea = function (){ + return this.height * this.width + } +} + +let rectangle = new Rectangle(10, 2) +console.log(rectangle.getArea()) + +//通过call方法继承 +function Rectangle(height, width){ + this.name = 'rectangle'; + this.width = width; + this.height = height; + + this.getArea = function (){ + return this.height * this.width + } +} + +function Square(a){ + Rectangle.call(this, a, a); + this.name = 'square' +} + +let square = new Square(10); +console.log(square.getArea()) +//原型链式继承 +let square = new Square(10); +console.log(square.__proto__.__proto__) + + +//原型链式继承 +function Rectangle(height, width){ + this.name = 'rectangle'; + this.width = width; + this.height = height; + + this.getArea = function (){ + return this.height * this.width + } +} + +function Square(a){ + this.height = a; + this.width = a; + this.name = 'aquare' +} + +Square.prototype = new Rectangle() +square = new Square(10) +console.log(square.getArea()) \ No newline at end of file -- Gitee From d40c95055ff1462aaa311e0f5611ef507a9f4aaa Mon Sep 17 00:00:00 2001 From: doepy <8428487+doepy@user.noreply.gitee.com> Date: Sun, 16 May 2021 17:12:45 +0800 Subject: [PATCH 9/9] =?UTF-8?q?3=E7=8F=AD=5F=E9=99=B6=E5=86=B6=5F=E7=AC=AC?= =?UTF-8?q?=E5=8D=81=E4=B9=9D=E5=91=A8=E4=BD=9C=E4=B8=9A=203=E7=8F=AD=5F?= =?UTF-8?q?=E9=99=B6=E5=86=B6=5F=E7=AC=AC=E5=8D=81=E4=B9=9D=E5=91=A8?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../week19_3pra.js" | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_3/week19_3pra.js" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_3/week19_3pra.js" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_3/week19_3pra.js" new file mode 100644 index 00000000..f31b4146 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232_3/week19_3pra.js" @@ -0,0 +1,76 @@ +/* +* 异步JS callback promise async/await +* +* */ +//声明一个promise对象 +let promiseObj = new Promise( (resolve, reject) => { + + setTimeout(() => { + resolve("success"); + reject("failed"); + }, 3*1000) +}).then(result => {console.log("result => ", result)}) + +console.log(promiseObj) + +//声明一个xhr请求 +function xhrRequest(url){ + return new Promise((resolve, reject) => { + const xhr =new XMLHttpRequest(); + xhr.open('GET.url'); + xhr.onload = function (){resolve(xhr.responseText)}; + xhr.onerror = () => reject(xhr.status); + xhr.send() + }).then(result=>{console.log("SUCCESS", result)}) + .catch(error=>{console.log("FAILURE", error)}) +} + +//链式调用 +function xhrRequest(url){ + return new Promise((resolve, reject) => { + const xhr = new XMLHttpRequest(); + xhr.open('GET', url); + xhr.onload = function(){resolve(xhr.responseText)}; + xhr.onerror = () => reject(xhr.status); + xhr.send() + }).then(result=>{console.log("SUCCESS", result); return result}) + .then(result=>{console.log("SUCCES 2", result)}) + .catch(error=>{console.log("FAILURE", error)}) +} + +//通过async和await等待完成结果 +function xhrRequest(url){ + return new Promise((resolve, reject) => { + const xhr =new XMLHttpRequest(); + xhr.open('GET', url); + xhr.onload = function (){resolve(xhr.responseText)}; + xhr.onerror = () => reject(xhr.status); + xhr.send() + }).then(result=>{console.log("SUCESS", result); return result}) + .catch(error=>{console.log("FAILURE", error); throw TypeError}) +} + +async function requestBaidu(url){ + let result = await xhrRequest(url); + console.log("DONE!", result) +} + +//异常处理 +function xhrRequest(url){ + return new Promise((resolve, reject) => { + const xhr =new XMLHttpRequest(); + xhr.open('GET', url); + xhr.onload = function (){resolve(xhr.responseText)}; + xhr.onerror = () => reject(xhr.status); + xhr.send() + }) +} + +async function requestBaidu(url){ + try { + let result = await xhrRequest(url); + console.log("DONE!", result) + }catch (e){ + console.log("FAILURE",e) + } +} \ No newline at end of file -- Gitee