mercredi 26 juillet 2017

Why is my last AND condition returning false in the if statement

I have an array as follows:

var temp = ["5","5","5","5"];

And here is the If condition:

if((temp[0] == temp[1]) && (temp[1] == temp[2]) && (temp[2] == temp[3])){
   square++;
}

Why is my last condition temp[2] == temp[3] returning false? When I check the values of both these indexes in the console, they show equal, but the condition itself returns false.

Any ideas?

Aucun commentaire:

Enregistrer un commentaire