Node.js examples for Array:Array Operation
Move Fixed Array Elements
function moveFixedArrayElements ( array, begIndex, endIndex, offset ) { var i;/*from w ww . j a v a 2 s . c om*/ if ( offset > 0 ) { i = endIndex + offset; if ( i >= array.length ) i = array.length - 1; while ( true ) { if ( i < begIndex ) return; array[ i ] = array[ i - offset ]; i -= 1; } } else { i = begIndex + offset; if ( i < 0 ) i = 0; while ( true ) { if ( i >= endIndex ) return; array[ i ] = array[ i - offset ]; i += 1; } } }