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

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -