function MyObject(){
this.name = "myObject";
this.type = "class";
this.methodA = function(){
alert(this.name);
}
this.methodB = function(){
return this.type;
}
}
var myObject = new MyObject();
myObject.methodA();
var type = myObject.methodB();
alert(type);
温馨提示:答案为网友推荐,仅供参考