Any data / calculations processed in JavaScript in the browser will be unsafe, since all the code is executed on the local computer. I would recommend listing all the parameters that are critical to a fair game experience, such as player position, rating, resources ... and calculate server-side management of these parameters. You only collect user inputs from the browser and send the updated status to the browser for display.
Even if you decide to compute some values on the browser side to avoid latency, you should not take them into account for the global state shared by the players, and you should re-synchronize the local state with the global state - always in the direction from global to local - time from time.
, , , , , . .