jquery - How to create an array in javascript with element at specific position only? -
i need create array in javascript 1 (or more) given element @ given position.
see following snippet:
params = []; params[5] = "my value" params[14] = "my other value"; console.log(params);
all elements don't initialize (as expected) undefined. can delete these undefined elements, before or after array created?
also, happens if set array post data jquery $.ajax() call?
why don't use object then?
params = {}; params[5] = "my value" params[14] = "my other value"; console.log(params);
Comments
Post a Comment