La creación de la clase js

Cada objeto tiene la propiedad prototipo de JavaScript, atributo Javascript objetos prototipo interpretación son: devolver una referencia al tipo de objeto prototipo.

Ejemplo:

var ShapeBase = function () {
}
ShapeBase.prototype = {
show: function () {
alert ( "ShapeBase show2");
},
Init: function () {
alert ( "init2 ShapeBase");
}
};
prueba de función (src) {
var s = new ShapeBase ();
s.init ();
s.show ();
}
De prueba ( "test");

Supongo que te gusta

Origin www.cnblogs.com/jwangh/p/12449106.html
Recomendado
Clasificación