I am working on an array of array, and I want to test each first value but all what I get is Uncaught TypeError: Cannot read property '0' of undefined. Help please!
function getManualDesactivation(data){
var tab=[];
var l=data.length ;
var listeService= getCategorie(data);
var resultat=[];
for(var i=0; i<l;i++){
if (data[i][1] == "DESACTIVATION") {
var subtab=[];
subtab.push(data[i][0]);
subtab.push(data[i][2]);
tab.push(subtab);
}
}
if (tab.length > 1) {
var j = 0;
for (var i = 0; i < listeService.length; i++) {
if (listeService[i] == tab[j][0]) {<---- here is the exception
resultat.push(tab[j][1]);
j++;
} else {
resultat.push(0);
j++;
}
}
}
Aucun commentaire:
Enregistrer un commentaire