100% security is not achievable when you need to trust data from the client. However, you can complicate the deception by confusing the js code, as well as the data that you send from the client.
I have an idea similar to gviews comment.
On the server, you must monitor the process of players in the game using batch updates that you will regularly send from the client at some interval ... The player will not recognize it in latency, and you will have a tool to detect obvious cheaters. You know the starting point of a players game, so you can easily spot cheating from the start.
In addition, I would suggest using some control points where you could check the real state of the game on the client and the state on the server. (the state of the client will not change if the cheater only changes server updates by xhr).
There are many ways to make it harder to cheat, and it is quite individual for each game ... there is no standard that solves all this.
source share