title: Prevent JavaScript Hacking
body: <p>I've created a trivial game using JavaScript and AngularJS. While presenting it to my team today, a team member hacked the code and won the game because of it.</p>
  
  <p>The idea is that each player clicks a button to generate a random number between 1-100. Tom (screenshot below), put a breakpoint in the JavaScript and changed the number to 99 each time.</p>
  
  <p>Is there a way to prevent this? From what I've heard, and from some googling, it appears that it's not possible to prevent this; a trip to the server needs to be made so that the random number can be generated there.</p>
  
  <p>Is that right? Do I need to change my game to make a server call for every generation of a random number? If so, is there at least some way to make it extremely difficult to hack within the browser? Using JavaScript and AngularJS, it was nice to have this all on the front end; it was quick and easy.</p>
  
  <p><img src="https://i.stack.imgur.com/fe1d7.png" alt="enter image description here"></p>