title: JavaScript - Insert & Remove a element in object
body: <p>I have a object.</p>
  
  <pre><code>var dl_items;
  </code></pre>
  
  <p>After a loop for inputing data:</p>
  
  <pre><code>dl_items[code] = itemObject;
  </code></pre>
  
  <p>I have a array:</p>
  
  <pre><code>dl_items : {
              "code_A" : { "index" : 1, "status" : 2, "name" : A_data},
              "code_B" : { "index" : 2, "status" : 0, "name" : B_data},
              "code_C" : { "index" : 3, "status" : 1, "name" : C_data},
              "code_D" : { "index" : 4, "status" : 2, "name" : D_data},
              "code_E" : { "index" : 5, "status" : 4, "name" : E_data}
             }
  </code></pre>
  
  <p>Now I want to remove "dl_items[code_D]" and insert it into after "code_A" (index 2) for result like : </p>
  
  <pre><code> dl_items : {
              "code_A" : { "index" : 1, "status" : 2, "name" : A_data},
              "code_D" : { "index" : 4, "status" : 2, "name" : D_data},
              "code_B" : { "index" : 2, "status" : 0, "name" : B_data},
              "code_C" : { "index" : 3, "status" : 1, "name" : C_data},                
              "code_E" : { "index" : 5, "status" : 4, "name" : E_data}
              }
  </code></pre>
  
  <p>I try to use "delete" after using a loop to find index of code_D:</p>
  
  <pre><code>delete dl_items[code_D];
  </code></pre>
  
  <p>and it successful removed but how can i insert code_D into his new index ?</p>
  
  <p>Edit : Thanks all everyone to help me understand more about array.</p>