function createhero(name,home,weap) {
this.name = name;
this.home = home;
if (weap == undefined) {
this.weap = 'jian'
}else{
this.weap = weap;
}
this.skill = function(){
alert(this.name+'向敌人发动攻击');
}
}
var hero1 = new createhero('赵日天','断罪小学','刀');
delete hero1.name; //为什么不写成delete(hero1.name)
相关分类