You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function A(){
}
var obj = new Object(); // 创建一个空对象
obj.__proto__ = A.prototype; // obj的__proto__指向构造函数的prototype
var result = A.call(obj); // 把构造函数的this指向obj,并执行构造函数把结果赋值给result
if (typeof(result) === 'object') {
A = result; // 构造函数F的执行结果是引用类型,就把这个引用类型的对象返回给objB
} else {
A = obj; // 构造函数F的执行结果是值类型,就返回obj这个对象给objB
}
1.对象模型的细节
2.继承与原型链
3.call() 和 apply()
4.Object.creat()
5.Object.create()、new Object()和{}的区别
6.详解JS构造函数方法与原型prototype上的方法
7. instanceof()
8. setPrototypeOf()
prototype是构造函数方法特有,与new关键字配合使用,每个实体对象都有__proto__属性
The text was updated successfully, but these errors were encountered: