Function Convert integer to binary string
function toBinary ( n ) { let r = " " ; while ( n != 0 ) { r = ( n % 2 == 0 ? " " : " " ) + r ; n = Math . floor ( n / 2 ) ; } return ( r == " " ) ? " " : r ; }