Q:

jQuery compare two sets of objects and get the location of the difference in the value

There are a lot of questions about comparing two sets of JavaScript object on this site, but I couldn't find what I am trying to achieve.
I have two sets of objects as below.
var players = [
                { "id" : "45783",
                  "r3" : "DED" },
                { "id" : "54762",
                  "r3" : "DEDCCCCDDDDC" },
                { "id" : "78903",
                  "r3" : "DEDCDBDDDDDC"}
              ]
var oldPlayers = [
                { "id" : "45783",
                  "r3" : "DE" },
                { "id" : "54762",
                  "r3" : "DEDCCCCDDDD" },
                { "id" : "78903",
                  "r3" : "DEDCDBDDDDD"}
              ]

I want to compare the data above and find exact locations in the var players, "r3" value that's different from oldPlayers.
For example, 
players ---- "r3" : "DED"
oldPlayers - "r3" : "DE"

The difference in above data is players has additional D at the character position at [2] assuming the the number starts from 0.
I have each loop that I am intending to get this location, and I am stuck how to make this work.
var isOldPlayers = false;

// check if oldPlayers exists
 if(oldPlayers != undefined && oldPlayers != ''){
   isOldPlayers = true;
 }

$.each(players,function(i,v){

if(isOldPlayers){
  var oldScores = oldPlayers[i]['r3'];
  var newScores = this['r3'];

   if(newScores != oldScores){
      // how can I get the exact location of the difference?
    }

  }
});

A:

If I understand you correctly, this should do what you need:

var players = [
                { "id" : "45783",
                  "r3" : "DED" },
                { "id" : "54762",
                  "r3" : "DEDCCCCDDDDCDEWE" }, // I added chars here to show how to get the rest of the string that is different
                { "id" : "78903",
                  "r3" : "DEDCDBDDDDDC"}
              ]
var oldPlayers = [
                { "id" : "45783",
                  "r3" : "DE" },
                { "id" : "54762",
                  "r3" : "DEDCCCCDDDD" },
                { "id" : "78903",
                  "r3" : "DEDCDBDDDDD"}
              ]
$.each(players,function(index, element){
  var newR3= players[index]["r3"].split('');
  var oldR3= oldPlayers[index]["r3"].split('');
  var curId= players[index]["id"];
  
  $.each(newR3,function(i, el){
     if(el != oldR3[i]){
       $('#myDiv').append('Object '+index+' (id '+curId+') in players is different than object '+index+' (id '+curId+') in oldPlayers starting at index: '+i +'<br>');
       $('#myDiv').append('The rest of the string, from the fist difference to the end is: ' + newR3.slice(i).join('') +'<br><br>');
       
       return false;
       }


  });


});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div id="myDiv"></div>

