copy array element in to new array twice
for ( let i = 0 ; i < Length ; i ++ ) { tmp [ i ] = A [ i ] tmp [ i + Length ] = A [ i ] } for ( let i = rotation ; i < rotation + Length ; i ++ ) { A [ i - rotation ] = tmp [ i ] ; } }