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

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -