An array of objects to change position

// switch array location 
    swapArray (ARR, index1,, index2) { 
      ARR [index1,] = arr.splice (index2,. 1, ARR [index1,]) [0 ];
       return ARR; 
    }, 
    // Move 
    zIndexUp (arr, index , length) {
       IF (= index +. 1! length) {
         the this .swapArray (ARR, index, index +. 1 ); 
      } the else { 
        Alert ( 'already in the top, can not move' ); 
      } 
    }, 
    zIndexDown (ARR, index, length) { 
      IF (index = 0! ) {
         the this .swapArray (ARR, index, index-. 1 ); 
      } the else{ 
        Alert ( 'has been set at the bottom, not down " ); 
      } 
    }

 

Guess you like

Origin www.cnblogs.com/hpx2020/p/11511111.html