Home > Article > Web Front-end > What is the running process of new operator in js
例:var obj = new Base(); 该步一共做了三件事:即 var obj = {}; obj.__proto__ = Base.prototype; Base.call(obj); 第一行,我们创建了一个空对象obj 第二行,我们将这个空对象的__proto__成员指向了Base函数对象prototype成员对象 第三行,我们将Base函数对象的this指针替换成obj。
The above is the detailed content of What is the running process of new operator in js. For more information, please follow other related articles on the PHP Chinese website!