text: Smallest power of 2 greater than or equal to n | Program to find smallest power of 2 greater than or equal to n ; Driver Code
code: function nextPowerOf2 ( n ) { p = 1 ; if ( n && ! ( n & ( n - 1 ) ) ) return n ; while ( p < n ) p <<= 1 ; return p ; } n = 5 ; document . write ( nextPowerOf2 ( n ) ) ;