Javascript random array -


var title = 'a', 'b'; var length = 326, '424'; 

how random pick options , make sure if picks 'a' needs pick '326' , how assign them number?

for instances if picks automatically needs 326 , need give

 var title1 = (picked number)      var length = (picked number) 

and other didn't pick need make

var title2 = (title didn't pick) var title2 = (didnt picked length) 

you can create own object:

data=new array(); data[0]=new data('a',326); data[1]=new data('b',424);  function data(title,length) {     this.title=title;     this.length=length;     return this; }  console.log(data); 

now need choose random element data array. access values use:

data[0].title data[0].length 

for example.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -