JavaScript / Create object with map -



JavaScript / Create object with map -

i have next definition in js:

var multipartmap = { parts: [] };

so can next:

multipartmap.parts[partparams.partnumber - 1] = { etag: mdata.etag, partnumber: number(partparams.partnumber) };

but want have ability next:

multipartmap[id].parts[partparams.partnumber - 1] = { etag: mdata.etag, partnumber: number(partparams.partnumber) };

so multipartmap map of objects.

edit:

to clarify, want in multipartmap[0] array of parts, , in multipartmap[1] , on.. number dynamic parameter user.

how can it?

it looks want

var multipartmap = { someid: { parts: [] }, someotherid: { parts: [] }. etc. };

now "id" mention in multipartmap[id].parts can "someid" or "someotherid".

edited add: mention ids dynamic. that's fine , work same.

you'll start with

var multipartmap = {};

then when id , array of parts, can do

multipartmap[id] = {parts: []};

and you'll end same construction have above.

javascript

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -