diff --git a/sxss/.keep "b/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/.keep" similarity index 100% rename from sxss/.keep rename to "15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/.keep" diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\345\216\237\345\236\213\347\254\224\350\256\260.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\345\216\237\345\236\213\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..f1546bc8f9ec6549e98bbb2b16c6f79245c24a20 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232/\345\216\237\345\236\213\347\254\224\350\256\260.md" @@ -0,0 +1,19 @@ +# 原型 + +每个构造函数都会自动生成一个prototype属性,指向一个**空对象**,这个空对象就是原型。每一个实例对象都会从原型继承属性和方法。 + +原型对象中有一个属性constructor, 它指回函数本身 + +1. 显示原型和隐式原型 + (1)每个函数function都有一个**prototype**,即显式原型(属性)(构造函数的原型) + (2)每个实例对象都有一个___**proto**___,可称为隐式原型(属性)(实例对象的原型) + (3)对象的隐式原型的值对应构造函数的显式原型的值,构造函数和实例对象之间没有直接关系 +2. 函数的prototype属性: 在定义函数时自动添加的, 默认值是一个空Object对象,对象的___**proto**___属性: 创建对象时自动添加的, 默认值为构造函数的prototype属性值 +3. 实例化:如果构造函数上与原型属性重复,优先选取构造函数的属性 +4. 函数是Function的实例 +5. Function也是个函数,它是new自身产生:Function = new Function(),所以所有函数对象的__proto__都是一样的 +6. 所有函数的显示原型prototype是new Object(),所有函数对象都是new Function()生成的 + +![](E:\JS\原型\20221026160400.jpg) + +![](E:\JS\原型\image-20221103173743080.png) \ No newline at end of file diff --git a/sxss/10.27/.keep "b/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/.keep" similarity index 100% rename from sxss/10.27/.keep rename to "15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/.keep" diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/11-02-\344\270\245\346\240\274\345\207\275\346\225\260\344\275\234\344\270\232.html" "b/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/11-02-\344\270\245\346\240\274\345\207\275\346\225\260\344\275\234\344\270\232.html" new file mode 100644 index 0000000000000000000000000000000000000000..73321fd61fa27fa4235842b0766a62e3788b33e4 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/11-02-\344\270\245\346\240\274\345\207\275\346\225\260\344\275\234\344\270\232.html" @@ -0,0 +1,42 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/11-02-\344\270\245\346\240\274\345\207\275\346\225\260\347\254\224\350\256\260.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/11-02-\344\270\245\346\240\274\345\207\275\346\225\260\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..bc95c7cfd31b88af67bbe75d37d7dd83090e693d --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/11-02-\344\270\245\346\240\274\345\207\275\346\225\260\347\254\224\350\256\260.md" @@ -0,0 +1,80 @@ +第十二课:严格函数 + +​ arguments:伪数组,只有下标,长度,元素是实参的映射 + +改变this指向 + +​ // 函数被执行时,内部会产生一个this + +``` + // window.getNum(); +``` + +严格模式:防止意外发生错误时,及时抛出该错误 + +​ 1.在严格模式下,函数内部不会再意外地生成全局变量,而是抛出异常 + +例题: + +``` +function getName(a,b,a){ + 'use strict' + console.log(a); + a = 5; + + } + getName(1,3,5); + console.log(a); +``` + + + +​ 2.严格模式要求一个对象内的所有属性名在对象内必须唯一 + +例题: + +``` +"use strict" + var obj = { + a:1, + a:2, + b:4 + } + console.log(obj.a); + + function Product(name, price) { + 'use strict' + console.log(this); //null Prodcut Window + this.name = name; + this.price = price; + } +``` + +​ 3.call(null) call(undefined):严格模式下会抛出错误,非严格模式会自动转换全局 + +例题: + +``` +Product.call(undefined, '张三', 15) +``` + +​ 4.构造函数使用严格模式,必须使用new + +例题: + +``` +function Product(name, price) { + 'use strict' + this.name = name; + this.price = price; + } + new Product('张三',18); +``` + +​ 构造函数:Person( ); + +​ 普通函数小驼峰:getNameAge; + +​ 普通变量: personAge person_age; + +​ 常量:Pl \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/12.html" "b/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/12.html" new file mode 100644 index 0000000000000000000000000000000000000000..73321fd61fa27fa4235842b0766a62e3788b33e4 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/12.html" @@ -0,0 +1,42 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/sxss/10.27/\345\276\256\344\277\241\345\233\276\347\211\207_20221026162847.jpg" "b/sxss/10.27/\345\276\256\344\277\241\345\233\276\347\211\207_20221026162847.jpg" deleted file mode 100644 index c403f35da5ee63529573adc805d3ee0708637806..0000000000000000000000000000000000000000 Binary files "a/sxss/10.27/\345\276\256\344\277\241\345\233\276\347\211\207_20221026162847.jpg" and /dev/null differ