(1) Create a new object and let this pointer point to it;
(2) Assign all members of the function’s prototype object to this new object;
(3) Execute the function body and modify this object Perform initialization operations;
(4) returns the object created in (1).
function BB(a){
this.aa();
alert("s");
}
//alert(typeof BB.prototype.constructor);
BB.prototype.aa= function(){alert("sss");}
var nn=new BB("cc");
//var nn={};BB.apply(nn)
//nn= BB.prototype;
alert(nn.constructor);
Statement: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