J
args is a set of arguments.Also, the location of the mass can be used as a function that will take early data and, on the basis of these data, will carry out certain actions.The number of conditions in the same iteration is chosen.var args=[1,2,3,4,5,6,7,8,9];
var q=5;
var w=0;
while((w++)<10){
if(q<args[~~(Math.random()*args.length)]){
console.log('true');
}else{
console.log('false');
}
}
Example with a range of functions where conditions are prescribed:var args=[
function(e){
if(e<3){
console.log('a1 true');
}else{
console.log('a1 false');
}
},
function(e){
if(e==3){
console.log('a2 true');
}else{
console.log('a2 false');
}
},
function(e){
if(e>3){
console.log('a3 true');
}else{
console.log('a3 false');
}
}
];
var argsLength=args.length;
var w=0;
while((w++)<10){
q=[];
while(q.length<argsLength){
randomIndex=~~(Math.random()*argsLength);
if(q.indexOf(randomIndex)<0){
q.push(randomIndex);
}
}
console.log(q);
console.log('new random args '+w);
r=0;
while(r<argsLength){
argsq[r];
r++;
}
}