Due to Js referencing objects, I am in a bit of a pickle.

I have a Js "class" that creates a new player. The class has a few different variables, strings and array etc and some functions for checking certain things to do with those variables.

I am doing a while loop (ends when one player is declared dead) and after the loop is done, I want to "reset" the instantiated classes so I can run the loop again (a nested while loop).

e.g.

```
function Player(name)
{
    this.name = name;
    this.hp = 100;

    this.isnotdead = function()
    {
        return hp > 0;
    }
}

var player1 = new Player('player1');
var player2 = new Player('player2');

while(war_is_happening)
{
  while(player1.isnotdead || player2.isnotdead)
  {
    fight(player1, player2); // one of the players is killed
  }

  declareWinner(); // one player is a winner, lets fight again

  resertPlayers() // I want to start the nearest while loop again, but with fresh variables for player 1 and player2
}

```

Hope this makes sense.

Previously I've used stuff like `JSON.parse(JSON.stringify(player1))` to make a copy of the object, but now my object (class) has methods inside it so this doesn't work.