Home > Web Front-end > JS Tutorial > body text

Detailed explanation of prototype class_javascript skills

WBOY
Release: 2016-05-16 19:26:24
Original
1086 people have browsed it

//Perfume is bad 06-07-19 TKS: Linzi, provide a place for everyone to communicate and share
var Class = {
create: function() {
return function() {
this .initialize.apply(this, arguments);
}
}
}
can be rewritten as follows: it may be clearer:
var Class={
create:function( ){
return cls_initfunc
}
}

var cls_initfunc = function()
{
this.initialize.apply( this,arguments);
}

//The create method of the above Class object obviously returns an object construction function
//At the same time, execute the this.apply method in the component function to initialize the object
//This parameter is used for replacement Object, arguments are the parameters accepted by the initialize function. By executing " " (this, arguments);
}
obj.prototype={
initialize:function(){
//do ur init in here
},

,


}

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!