Function to check if the number N having all digits lies in the set ( 0 , 1 , 8 )
function isContaindigit ( n ) { while ( n > 0 ) { if ( ! ( n % 10 == 0 n % 10 == 1 n % 10 == 8 ) ) return false ; n = parseInt ( n / 10 , 10 ) ; } return true ; }