DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Find Log Base 10 Using Javascript

06.20.2011
| 6744 views |
  • submit to reddit
        We can't calculate the Log for 10 in js.

function calculate() {
	var log1 = document.getElementById('log').value;
	var base1 =10;
	var dn=1;
	dn=Math.log(base1);
	var ans=Math.log(log1)/dn;
	alert(ans);
}

This is the tool which calculate the log for any base from this tool. <a href="http://ncalculators.com/number-conversion/log-logarithm-calculator.htm">Log calculator</a>

For online Currency Conversion
<a href="http://exchangerate360.com">Currency Conversion</a>