It's a nontrivial problem, Javascript or no. There are a few approaches you could explore, and you might find it an interesting research project.
I believe, though, that the iPhone, some Samsung phones, and Teams already have a voice isolation feature that might do what you want here, so you may not have to implement it yourself. You could just recommend that players use a supported phone and turn the voice isolation on.
Interesting, thanks.
I was thinking perhaps something in the browser's WebRTC stack might have some kind of voice isolation in it for video conferencing too. I'll investigate.