easy,
but i need to know what context you are working in, a plugin or a scriptcall in battle?
lets assume you are making a plugin and you want to do something to the enemy during while alive battle
can get that instance of the enemy like this:
Code:this; //for within the game enemy class
you can find its index like this
Code:var troopIndex = $gameTroop.members().findIndex(this);
now
findIndex() is an Array function that will get an index from an array. it will return -1 if that enemy doesn't exist within that array. (possibly if its dead)
once we have our index we can use it to do something
Code:if(troopIndex === 5) { //we know its a number so we might as well use strict comparison
//do something
}