For some reason the following code doesn't work.
var a1 = Math.floor(Math.random()*4+1);
//Answer2
for(a2 = 0; a2 != a1 && a2 != 0; a2 = Math.floor(Math.random()*4+1)){
alert(a2);
}
I'm trying to get "a2" to be a int from 1-4 but not equivalent to "a1".
What's wrong? Thanks in advance!!!
EDIT:
Thank you all for your help! Here's my final result:
var a1, a2;
a1 = Math.floor(Math.random()*4+1);
a2 = a1;
while(a2 == a1){
a2 = Math.floor(Math.random() * 3 + 1);
alert(a2);
}