|
@@ -3,7 +3,7 @@
|
|
|
* @Autor: LC
|
|
* @Autor: LC
|
|
|
* @Date: 2022-01-20 10:45:55
|
|
* @Date: 2022-01-20 10:45:55
|
|
|
* @LastEditors: LC
|
|
* @LastEditors: LC
|
|
|
- * @LastEditTime: 2022-01-25 16:36:53
|
|
|
|
|
|
|
+ * @LastEditTime: 2022-01-25 16:39:51
|
|
|
* @Description: file content
|
|
* @Description: file content
|
|
|
-->
|
|
-->
|
|
|
# JavaScipt语法
|
|
# JavaScipt语法
|
|
@@ -1255,7 +1255,7 @@ console.log(obj.__proto__);
|
|
|
当创建一个函数后,JS引擎会自动给函数对象添加属性`Foo.prototype = { constructor : Foo }`
|
|
当创建一个函数后,JS引擎会自动给函数对象添加属性`Foo.prototype = { constructor : Foo }`
|
|
|
定义`Foo()`函数时,相当于`new Funtion()`创建函数对象,这时编译器执行`Foo.__proto__ = Function.prototype`,而`Function.prototype = { constructor : Function } `
|
|
定义`Foo()`函数时,相当于`new Funtion()`创建函数对象,这时编译器执行`Foo.__proto__ = Function.prototype`,而`Function.prototype = { constructor : Function } `
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
> `Function`是极为特殊的对象,它的`prototype`和`__proto__`相等
|
|
> `Function`是极为特殊的对象,它的`prototype`和`__proto__`相等
|
|
|
|
|
|
|
@@ -1272,9 +1272,9 @@ console.log(Foo.__proto__.constructor); // Function : Function
|
|
|
console.log(Function.prototype === Function.__proto__); // true
|
|
console.log(Function.prototype === Function.__proto__); // true
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
## ES6~ES12
|
|
## ES6~ES12
|
|
@@ -1367,7 +1367,7 @@ class Student extends Person {
|
|
|
|
|
|
|
|
[在线babel网站](https://babeljs.io/)
|
|
[在线babel网站](https://babeljs.io/)
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
### 继承内置类
|
|
### 继承内置类
|
|
|
|
|
|