mercredi 28 septembre 2016

How to test whether a variable is equal to one of five Array Values

I am storing five values in an array and I need to check whether a variable I've set up is equal to one of those values. Here is what I mean:

var x = e.clientX, // horizontal mouse position
myArray = []; // I have another function that stores five values in this array

if(x == /*one of the five array values*/){
    //do something
}

Thanks...

Aucun commentaire:

Enregistrer un commentaire