How to overwrite instant death on 0 hp

Hey, I'm the same guy thinking about adding a death's door mechanic.
So I was looking through the codes and found this:

Code:
Game_Battler.prototype.refresh = function() {
    Game_BattlerBase.prototype.refresh.call(this);
    if (this.hp === 0) {
        this.addState(this.deathStateId());
    } else {
        this.removeState(this.deathStateId());
    }
};

I want to overwrite it so that this.hp will be -1.
I'm very new to JavaScript (still haven't memorized all the operators) and I don't think I can just rewrite the function in my code.
You want to change this.hp === 0 to check for -1 instead? just change it to this.hp === -1
Just like that? Shouldn't there be conflicts, etc?

Original thread: https://forums.rpgmakerweb.com/threads/how-to-overwrite-instant-death-on-0-hp.98810/