Javascript program to check clockwise or counterclockwise order in an array
function check_order ( arr ) { var cnt = 0 ; for ( i = 0 ; i < arr . length - 1 ; i ++ ) { if ( Math . abs ( arr [ i + 1 ] - arr [ i ] ) > 1 ) cnt ++ ; }