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

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -