Binary conversion
let v = [ ] ; while ( n != 0 ) { v . push ( n % 2 ) ; n = parseInt ( n / 2 ) ; } for ( let i = 0 ; i < v . length ; i ++ ) { if ( v [ i ] == 1 ) { return Math . pow ( 2 , i ) ; } } return 0 ; }