I am trying to make a loop on the array that contains some of bus seat numbers. but it always returns with false.
alert(response.reservedseats.indexOf("1"));//this line works and gives true
for (i = 1; i < 13; i++) {
if ( response.reservedseats.indexOf(i) > -1 ) { //This always gives -1 and there are some true conditions so it's give not found
alert("done");
}else{
alert('not found');
}
} ```
Aucun commentaire:
Enregistrer un commentaire