Math.log()
to get the logarithm from the value and the base and divide them.const logBase = (n, base) => Math.log(n) / Math.log(base);
logBase(10, 10); // 1
logBase(100, 10); // 2
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️