Hi, thanks for reading this,
I have 4 vars like so:
var a1='a'
var a2='aa2'
var a3='a'
var a4='a'
the values of these for can be dynamic. I'm only interested in the vars that have a value length equal to 1.
I would like to randonly select 2 from the vars that length=1. There may be an instance when all four will have length=1 or that only 1 will have length=1. But i need to know which vars have a length=1, how can this be done?
this what i have tried:
var myarray = new Array()
myarray[0]=a1
myarray[1]=a2
myarray[2]=a3
myarray[3]=a4
for(var i=0; i < myarray.length; i++ ){
if (a.length=1) {myarray=i;}else{myarray=""};
};
myarray.sort(randOrd);
//myarray[0] might be from var a1 and equal to "a"
//myarray[1]; might be from var a4 and equal to "a
I have 4 vars like so:
var a1='a'
var a2='aa2'
var a3='a'
var a4='a'
the values of these for can be dynamic. I'm only interested in the vars that have a value length equal to 1.
I would like to randonly select 2 from the vars that length=1. There may be an instance when all four will have length=1 or that only 1 will have length=1. But i need to know which vars have a length=1, how can this be done?
this what i have tried:
var myarray = new Array()
myarray[0]=a1
myarray[1]=a2
myarray[2]=a3
myarray[3]=a4
for(var i=0; i < myarray.length; i++ ){
if (a.length=1) {myarray=i;}else{myarray=""};
};
myarray.sort(randOrd);
//myarray[0] might be from var a1 and equal to "a"
//myarray[1]; might be from var a4 and equal to "a