javascript - How to save several data sets into array? -


i try write plugin krpano in javascript.

the actual problem have store several datasets right way can accessed later on.

i have number of rendered panoramic images (changes project project, 1-10max) can have variations of it. there can variations other flooring, other colours of kitchen, @ daytime , on. don't know in beforehand how many panoramic images there , how many variations have.

my thought use prompt(); information needed user , go loop create needed variables.

 var panocount = prompt("how many panos have?");      (var = 0; < panocount; i++) {         panooptions[i+1] = prompt("how many options have " + (i+1) + ". pano?");  } 

let's have 1 panoramic image 2 different floors, 2 different types of furniture , 2 different daytimes. total amount of 8 pictures (2*2*2).

in case, get:

 how many panos have?   -> 1 (store panocount)   how many options have 1. pano?   -> 3 (floors, furniture, daytime) 

now want prompt(); in loop asked how many variants have each option (variants of floors, variants of furniture, variants of daytime) , how named. (daytime, nighttime f.ex.)

what best way store data in javascript. should use arrays in array or there better solution?

further explanations of task: in general want build plugin html/xml based pano viewer can handle versions of pano. there menus in pano can f.ex. change floor , load new pano or change url of existing pano new one.

there no better way answer question. depends on way implement requirements in end.

but, if can help, suggest use array of objects store data easy , comprehensive access specific piece of data:

var mypanoset = [     {         panoname: "mypano1",         options: {             floor: [...],             furniture: [...],             daytime: [...]         }     } }; 

then can access data readable query like:

mypanoset[0].options['floor'].count; // how many floor have first pano. 

but you...

regards,


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -