-
I have a problem about loop and array
——————————————————————————–
var layersList = app.project.activeItem.selectedLayers;
var o=[layersList];
for (i=0;i<layersList.length;i++){
checkNAME[i]=layersList[i].name;
checkNAME2[i]=layersList[i].name;
index=checkNAME[i].lastIndexOf (“-“);
if(index>=0){
checkNAME[i]= checkNAME[i].substring (0, index);
}
if(checkNAME2[i].indexOf(checkNAME[i])!==-1){
if(checkNAME2[i].indexOf(“1”,index)>-1){ <—-1
o[i]=layersList[i];
}
}
}
for(i=0;i<layersList.length;i++){
if(o[i]==null){
continue;
}
if(layersList[i].name==o[i].name){
continue;
}
alert(layersList[i].name);<—-2
}
—————————————————————————————-
I try to use loop to collect layers to array of o and I want get the layer that have name like point 1 and put it and show the layer that not like 1 at 2 but it don’t show anything to me.
such as, I have layer A 01-1, A 01-2, A 01-3, B 01-1, B 01-2, B 01-3, B 01-4
It should be show A 01-2, A 01-3 and B 01-2, B 01-3, B 01-4