javascript - What is the best way to have an array of 2 properties? -


i'd have array in javascript each item contains 2 properties instead of 1, how possible?

the following adds 1 property item default:

var headercellwidths = new array(); headercellwidths.push(100); 

this enables me access item using [0][normalcellwidth]

but i'd able have e.g. [index][normalcellwidth][firsttemplatecellwidth]

e.g. [0][100][25]

e.g. headercellwidths.add(100, 25);

one solution create own customarray maintains 2 separate array instances isn't there better way?

thanks,

you can add entries objects array. try this:

 headercellwidths.push({normalcellwidth:100, firsttemplatecellwidth:25); 

you access items using:

headercellwidths[0].normalcellwidth , headercellwidths[0].firsttemplatecellwidth


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -