From 43ab5d523e812d1a12a5658c594b6d0565d173eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E7=8E=AE=E5=96=86?= Date: Thu, 3 Nov 2022 13:13:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=AC=AC=E5=8D=81=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\344\275\234\344\270\232/2022.11.02.html" | 31 +++++++++++++++++++ .../2022.11.02-apply&call.md" | 25 +++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 "04\351\203\221\347\216\256\345\226\206/\344\275\234\344\270\232/2022.11.02.html" create mode 100644 "04\351\203\221\347\216\256\345\226\206/\347\254\224\350\256\260/2022.11.02-apply&call.md" diff --git "a/04\351\203\221\347\216\256\345\226\206/\344\275\234\344\270\232/2022.11.02.html" "b/04\351\203\221\347\216\256\345\226\206/\344\275\234\344\270\232/2022.11.02.html" new file mode 100644 index 0000000..8975bef --- /dev/null +++ "b/04\351\203\221\347\216\256\345\226\206/\344\275\234\344\270\232/2022.11.02.html" @@ -0,0 +1,31 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/04\351\203\221\347\216\256\345\226\206/\347\254\224\350\256\260/2022.11.02-apply&call.md" "b/04\351\203\221\347\216\256\345\226\206/\347\254\224\350\256\260/2022.11.02-apply&call.md" new file mode 100644 index 0000000..cfebcc0 --- /dev/null +++ "b/04\351\203\221\347\216\256\345\226\206/\347\254\224\350\256\260/2022.11.02-apply&call.md" @@ -0,0 +1,25 @@ +# 10 + +call,apply,bind + +改变this指向 + +函数被执行时,内部会产生一个this + +call传给对象属性值 + +apply传一个数组给对象 + +函数调用bind方法,返回一个带this指向的新函数 + +## 严格模式 + +严格模式:防止意外发生错误时,及时抛出该错误 + +1. 在严格模式下,函数内部不会再意外地生成全局变量,而是抛出异常 + +2. 严格模式要求一个对象内的所有属性名在对象内必须唯一 + +3. call(null) call(undefined):严格模式下会抛出错误,非严格模式会自动转换全局 + +4. 构造函数使用严格模式,必须使用new -- Gitee From bf0d163aa6da121e7563089bc1e1f4bfdb35735d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E7=8E=AE=E5=96=86?= Date: Fri, 4 Nov 2022 05:06:38 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E7=AC=AC=E5=8D=81=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑玮喆 --- .../2022.11.03-\345\216\237\345\236\213.md" | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 "04\351\203\221\347\216\256\345\226\206/\347\254\224\350\256\260/2022.11.03-\345\216\237\345\236\213.md" diff --git "a/04\351\203\221\347\216\256\345\226\206/\347\254\224\350\256\260/2022.11.03-\345\216\237\345\236\213.md" "b/04\351\203\221\347\216\256\345\226\206/\347\254\224\350\256\260/2022.11.03-\345\216\237\345\236\213.md" new file mode 100644 index 0000000..0bc4fc9 --- /dev/null +++ "b/04\351\203\221\347\216\256\345\226\206/\347\254\224\350\256\260/2022.11.03-\345\216\237\345\236\213.md" @@ -0,0 +1,9 @@ +**1.所有被该构造函数构造出的对象都可以继承原型上的属性和方法**。 + +prototype:定义构造函数构造出的每个对象的ancestor。 + +2.如果this有自己的属性,那么会覆盖掉原型上已有的属性。**(开发惯例:所有方法写到原型,部分属性写到this)一般来说属性是配置项,需要你主动传参去配置。但是一般来说某个插件的方法功能几乎是一致的 + +constructor:构造器 + + -- Gitee