title: expand an array in react js
body: <pre><code>componentWillMount(){
     this.expand();
    }
  componentDidMount(){}
  expand(){
  var re = [];
  this.state.reservation1.length = 9;
    for (var i = 0; i &lt; this.state.reservation1.length; i++) {
       if(this.state.reservation1[i]){
         re[i]=this.state.reservation1[i]
         }
          else {
             re[i]= this.state.reservation1[i]=
                {name:"",active:false,dayindex:0}
              }
          }
     console.log(re)
    console.log(re.dayindex)
  
     }
  
  
  
  constructor(props){
    super(props);
    this.state = {
      reservation1:[
        {name:"8:30",active:true,dayindex:1},
        {name:"jad",active:true,dayindex:3},
        {name:"tony",active:true,dayindex:4},
        {name:"",active:false,dayindex:6},
      ],
      reservations:[]
    };
    this.expand=this.expand.bind(this);
  }
  </code></pre>
  
  <p>RE RETURN AN ARRAY OF 9 OBJECTS 
  re.dayindex is undefined 
  can someone help please </p>
  
  <p>i am trying to expand this array to reorder it by dayindex 
  any solution will be pleased</p>