Checking States of entire party

Was seeing if anyone can tell me what the script might be for checking if an anyone in the party has a certain state. I know you can make a conditional branch to check a specific actor, but there isn't (or I am missing) a way see if any of them do.

Example: If anyone in party has a broken leg, then the party movement speed is decreased. Since a group can only move as fast as its slowest member
Run a parellel process common event with a switch as a trigger. Turn it on at the beginning of the game. have wait 10 frames as the first command.Use conditinal branches for each possible party member (No Else branch) that checks if the broken leg status is inflicted. If it is, in a moveroute choose any speed slower than normal. Then have the event turn off it's switch. In anything that cures a broken leg

make it connect to a common event with no trigger that turns the first events switch back on and resets party speed(If anyone else has a broken leg, it will turn it'self back off
Yeah, I get that, and thanks for the input, but not really what I'm looking for. The main issue is that I'm going to have lots of expendable actors, and don's want to add each and everyone as I feel the need to do so. I also felt a smaller bit of script that only checks the party instead of a long list of actors would be a more efficient.
The following statement will be true if any actor in the party has a state, false if not.
Code:
$gameParty.members().some(actor => actor.isStateAffected(X))

The following statement will be true if any battle actor in the party has a state, false if not. By default the first 4 actors are battle actors.
Code:
$gameParty.battleMembers().some(actor => actor.isStateAffected(X))

The following statement will be true if any alive member of the party has a state, false if not.
Code:
$gameParty.aliveMembers().some(actor => actor.isStateAffected(X))

In all of the above, replace X with the ID of the state, such as 37.

Note: you can replace "some" with "every" in those formulas and it does what you think.

Edit: fixed typo it should be "isStateAffected" not "isStateAffect"
That's perfect Aloe, exactly what I needed! Very new to JS, and new how to start the script, but didn't know where to go from there. Plus, a couple others I hadn't thought about yet. Thanks a bunch!

Original thread: https://forums.rpgmakerweb.com/threads/checking-states-of-entire-party.114126/