Traté de pasar a nulo una instancia de clase pero fue en vano. Aquí avatar2 no se elimina, ¿por qué? registro de la consola
class Avatar{ constructor(name, weapon = "knife", pv = 100){ this.name = name; this.weapon = weapon; this.pv = pv; } attaqueDefault(target){ if (target.hasOwnProperty('pv')) target.pv -= 20; } attaqueCombine(target){ if (target.hasOwnProperty('pv')) target.pv -= 35; } destroy(target){ target = undefined; } } var avatar = new Avatar("tchod"); var avatar2 = new Avatar("tchod2", ".44"); avatar.destroy(avatar2);intenta cambiar de avatar a avatar
Avatar.destroy(avatar2);