check the result by processing the slope by starting three points
var slope1 = isSlopeGood ( arr [ 1 ] - arr [ 0 ] , arr , n ) ; var slope2 = isSlopeGood ( arr [ 2 ] - arr [ 1 ] , arr , n ) ; var slope3 = isSlopeGood ( parseInt ( ( arr [ 2 ] - arr [ 0 ] ) / 2 ) , arr , n ) ; if ( slope1 slope2 slope3 ) { return 1 ; } return 0 ; }