title: Pass object data to upper object property
body: <p>I have a array list which is bellow and want to assign a value from bottom to up.</p>
  <p><strong>Code sample:</strong></p>
  <pre><code>var tempArrayList=[
  {org1:null,org2:&quot;Office&quot;,org3:&quot;HR&quot;,org4:&quot;Payroll&quot;,org5:&quot;Pay&quot;},
  {org1:null,org2:null,org3:&quot;HR&quot;,org4:&quot;Payroll&quot;,org5:&quot;Pay&quot;},
  {org1:null,org2:&quot;Office&quot;,org3:null,org4:null,org5:&quot;Pay&quot;},
  {org1:null,org2:&quot;Office&quot;,org3:&quot;HR&quot;,org4:&quot;Payroll&quot;,org5:&quot;Pay&quot;},
  {org1:&quot;head1&quot;,org2:null,org3:null,org4:&quot;Payroll&quot;,org5:&quot;Pay&quot;}
  ];
  
  for(var i=0;i&lt;tempArrayList.length;i++) {   
      var temp=tempArrayList[i];
      var org1=temp.org1;
      var org2=temp.org2;
      var org3=temp.org3;
      var org4=temp.org4;
      var org5=temp.org5;
      
      document.write(JSON.stringify(temp));
      document.writeln(&quot;&lt;br&gt;&quot;);  
  }
  </code></pre>
  <p><strong>My Questions:</strong> how can I set the org2 value to org1, org3 value to org2......</p>
  <blockquote>
  <p>// if org1 is null then temp.org1 = temp.org2, temp.org2 = temp.org3, temp.org3 = temp.org4, temp.org4 = temp.org5</p>
  <p>// if org1 and org2 is null then temp.org1 = temp.org3, temp.org2 = temp.org4, temp.org3 = temp.org5, temp.org4 = null</p>
  </blockquote>