JavaScriptオブジェクトパッケージ(パーフェクト版)
556 ワード
//Apple
function Apple(color,weight,home) {
//
this.color=color;
this.weight=weight;
this.home=home;
this.price = new Array(12,15); //[12,15];
if(typeof Apple.created == "undefined") {
//
Apple.prototype.showHome=function() {
alert(this.home);
}
Apple.created = true;
}
}
// Apple
var objApple1 = new Apple("red",30,"china");
//
objApple1.price.push(23);