Count of current slope
var this_count = 1 ; for ( var i = 1 ; i < n ; i ++ ) { if ( compareDoubles ( parseFloat ( slope [ i ] ) , parseFloat ( slope [ i - 1 ] ) ) ) this_count ++ ; else { count [ k ++ ] = this_count ; this_count = 1 ; } } count [ k ++ ] = this_count ;