Stores logX to the base K
let k = Math . floor ( Math . log ( x ) / Math . log ( base ) ) ; if ( Math . abs ( Math . pow ( base , k ) - x ) < Math . abs ( Math . pow ( base , ( k + 1 ) ) - x ) ) return Math . pow ( base , k ) ; else return Math . pow ( base , ( k + 1 ) ) ; }