ioSamurai ioSamurai - 1 year ago 96
Javascript Question

How can I specify the base for Math.log() in JavaScript?

I need a

function for JavaScript, but it needs to be base 10. I can't see any listing for this, so I'm assuming it's not possible. Are there any math wizards out there who know a solution for this?

Answer Source

Logarithm for base 10

function log10(val) {
  return Math.log(val) / Math.LN10;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download