Following three lines generate the next circular permutation of a number . We move last digit to first position .
let rem = num % 10 ; let div = parseInt ( num / 10 , 10 ) ; num = ( ( Math . pow ( 10 , count - 1 ) ) * rem ) + div ;