MZ Help with Visustella <JS Targets>. How to target all enemies that has an X state.

So Im trying to make a skill that only targets enemies that has a specific state.
The below code doesn't seem to work

<JS Targets>
targets = $gameTroop.aliveMembers().isStateAffected(28)
</JS Targets>

The database skill scope is set to "Enemy All" and the game seems to only follow that instead of the notetag above.
Any help?
isStateAffected expects a single battler; to use it on an array/list of battlers, you'll need a loop of some kind. Arrays have a filter method that is very useful for this kind of thing! Technical details here:
Try something like this:

<JS Targets> targets = $gameTroop.aliveMembers().filter( enemy => enemy.isStateAffected(28) ); </JS Targets>
Now I understand! Works great! I appreciate it so much!
Thanks for informing me about how .filter() method works.
You're welcome! Happy RPG Making~

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-visustella-js-targets-how-to-target-all-enemies-that-has-an-x-state.147092/