0
var a=new Array;
for (j=0;j<=10;j++) {
a[j]=Math.floor(Math.random()*99)+2
}

var check=Math.floor(Math.random()*99)+2

So how do I check whether check is a value of any of the a[j] (that is a[0] to a[10])? A good and simple method?

user2028943
  • 131
  • 5

1 Answers1

3

Try this:

a.indexOf(check) > -1
ogzd
  • 5,532
  • 2
  • 26
  • 27