(untitled) · Oct 23, 2015
How to find the logarithm of a number with specified base
0Sign in to vote or save
This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.
Find the logarithm of a number (y) with specified base (x). log x Y function baseLog(x, y) { return Math .log(y) / Math .log(x); } Usage: console.log(baseLog( 5 , 25 )); // 2 console.log(baseLog( 7 , 49 )); // 2 console.log(baseLog( 2 , 8 )); // 3 console.log(baseLog( 4 , 64 )); // 3 console.log(baseLog( 2 , 16 )); // 4

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.