At present I've been using nested for loops to solve this issue:
for (var i = 0; i < this.props.trackedPlayers.length; i++)
{
for (var j = 0; j < PHP_VARS.players_data.length; j++)
{
// This check here is the key part
if (PHP_VARS.players_data[j]._id == this.props.trackedPlayers[i]._id)
{
data.push(// stuff from both arrays..);
}
}
}
However I figured there might be a boilerplate function that does this already. Done a few searches but nothing cropped up - any pointers, or is this the best I've got for now?
EDIT: Brief explanation, trackedPlayers are all from players_data. By checking if each player in the (generally) larger players_data is in trackedPlayers, I know whether or not to list them as an option for 'adding' to an HTML select field.