Whats the best way of creating a turn-based combat system?

I’ve been wanting to create a turn based rpg type game for awhile now and I’ve got most of the basic ui sorted out for the in and out of battle stuff but I’m wondering what would be the best way to actually create that turn based system. I’ve heard from other devs that have actually made these games that a table filled with the contents of each enemies and their stats along with a forloop and I’ve heard from others that they use stacks and I’m not sure which to choose. Ultimately what I’m looking for is something that’s simple enough for a beginnerish dev like me but still provides a good system that works well for players.

I imagine as long as you can handle race conditions and state it should be alright.

State is just a variable used to keep track of whats happening and whos turn is it.

Race condition is used to handle events with multiple outcomes, ex 1. Player input action, player left game, time ran out.

I imagine it should be similar to a round based game system as well its also a system with state and events. For this you can take a look at promises which help to organize such events.

You could also look at finite state machines which also handle state and events.

Thanks for the info! ill take a look, do you mind if i dm you incase i have any problems?