Prevent Javascript variable alteration & injection from Chrome Developer tool

Viewed 60

I built a javascript async code

    <script>



function sendVotes() {
        //some variables here that collects the number of votes a user input 
          var xhttp = new XMLHttpRequest();
          xhttp.onreadystatechange = function() {
          if (this.readyState == 4 && this.status == 200) {
            
          }
          };
          xhttp.open("POST", "async/vote", true);
          xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
          xhttp.send("id="+id+"&votes=" =votes);
         }
          </script>

I tried out the chrome debugging tool of which I got to notice that when script is paused on run time, variables can be changed and assigned new values e.g number of votes as in the sample code above

Is there a way to detect if the values of a variable is changed or a way to prevent such totally

0 Answers
Related