Home > Web Front-end > JS Tutorial > What is the running process of new operator in js

What is the running process of new operator in js

一个新手
Release: 2017-09-08 13:31:59
Original
2195 people have browsed it


例:var obj = new Base(); 
该步一共做了三件事:即 
   var obj  = {}; obj.__proto__ = Base.prototype; Base.call(obj);  

第一行,我们创建了一个空对象obj
第二行,我们将这个空对象的__proto__成员指向了Base函数对象prototype成员对象
第三行,我们将Base函数对象的this指针替换成obj。
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template