JavaScript创建一个删除其左侧的函数

时间:2016-11-09 10:49:18

标签: javascript

你怎么能删除这个或者有其他方法吗?

a= function() {
    this.delete= function() {
        delete battle;
    }
}
battle = new a();
battle.delete();

1 个答案:

答案 0 :(得分:0)

function Foo(battle) {
   this.battle=battle;
   this.distroyBattle=function() {
           this.battle=null;
   }   
}