Home > Web Front-end > JS Tutorial > The execution process of javascript new fun_js object-oriented

The execution process of javascript new fun_js object-oriented

WBOY
Release: 2016-05-16 18:21:35
Original
1290 people have browsed it

(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).
The execution process of javascript new fun_js object-oriented

Copy code The code is as follows:

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);
Related labels:
new
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