Pages

Javascript Math - log Method

Description:

This method returns the natural logarithm (base E) of a number. If the value of number is negative, the return value is always NaN.

Syntax:

Math.log( x ) ;
Here is the detail of parameters:
  • x : A numbers.

Return Value:

Returns the natural logarithm (base E) of a number.

Example:

<html>
<head>
<title>JavaScript Math log() Method</title>
</head>
<body>
<script type="text/javascript">

var value = Math.log(10);
document.write("First Test Value : " + value ); 
  
var value = Math.log(0);
document.write("<br />Second Test Value : " + value ); 

var value = Math.log(-1);
document.write("<br />Third Test Value : " + value ); 

var value = Math.log(100);
document.write("<br />Fourth Test Value : " + value ); 
</script>
</body>
</html>
This will produce following result:
First Test Value : 2.302585092994046
Second Test Value : -Infinity
Third Test Value : NaN
Fourth Test Value : 4.605170185988092 
 
+JavaScript +JavaScript Frameworks Links +Javascript Development 
+JavaScript's and More, Software and Marketing +JavascriptU +JavaScriptOn 
+Javascript Problems +JavaScriptOn 
 +javaScript is a creek in West Virginia in the summe  
+enJineS +JavascriptU +Javascript Tutor   

No comments:

Flag Counter
| Copyright © 2013 Remote Tutor