easy logs Kata
Math.log()
by trentHarlem
JavaScript
const logs = (x , a, b) => (Math.log(a*b) / Math.log(x))
//const logs = (x , a, b) => (Math.log(a) / Math.log(x))+(Math.log(b) / Math.log(x))
/* function logs(x , a, b){
return (Math.log(a) / Math.log(x))+(Math.log(b) / Math.log(x))
}
*/
//The following function returns the logarithm of y with base x (ie. \log_x y ):
/* function getBaseLog(x, y) {
return Math.log(y) / Math.log(x);
}
*/
//parseInt(string, radix)
console.log(logs(10, 2, 3), 0.7781512503836435);
console.log(logs(5, 2, 3), 1.1132827525593785);
console.log(logs(1000, 2, 3), 0.25938375012788123);