I have an Array of object
var Country = [];
It is something like
{
    "Name" : "IND"
    "Capital" : "Delhi"
    id : someID1
},
{
    "Name" : "USA"
    "Capital" : "WS"
    id : someID2
},
{
    "Name" : "UK"
    "Capital" : "London"
    id : someID3
}
Now I want to delete on of the element on certain condition. But it is throwing an error for more than 2 record.
My Error is : Cannot read property 'id' of undefined
My code is
remove : function(me, record, index){
    var CountryRec = this.Country;
    var CountryLen = this.Country.length;
    for(var i=0; i<CountryLen; i++){
        if(record.data.id == this.CountryRec[i].id){
            //delete this.checkRec[i];
            checkRec.splice(i,1);
        }
    }
}
This is throwing an error for more than 2 record. Please suggest me what I am doing wrong.
 
     
     
     
    