Straight | Function to check if N is a Straight Line number or not ; N must be > 99 ; Difference between consecutive digits must be same ; Given Number N ; Function Call
function isStraighLineNum ( N ) { if ( N <= 99 ) return false ; let s = N . toString ( ) ; let d = s [ 1 ] - s [ 0 ] ; for ( let i = 2 ; i < s . length ; i ++ ) if ( s [ i ] - s [ i - 1 ] != d ) return false ; return true ; } let n = 135 ; if ( isStraighLineNum ( n ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }