Find whether a given number is a power of 4 or not | Javascript program to check if given number is power of 4 or not ; Driver code
function isPowerOfFour ( n ) { return ( n > 0 && Math . pow ( 4 , ( Math . log2 ( n ) / Math . log2 ( 4 ) ) == n ) ) ; } let test_no = 64 ; if ( isPowerOfFour ( test_no ) ) document . write ( test_no + " " ) ; else document . write ( test_no + " " ) ;