JavaScript log() Method
Complete Math Object Reference
Definition and Usage
The log() method returns the natural logarithm (base E) of a number.
Syntax
Parameter |
Description |
x |
Required. A number |
Tips and Notes
Note: If the parameter x is negative, NaN is returned.
Example
In the following example we will use the log() method on different numbers:
<script type="text/javascript">
document.write(Math.log(2.7183) + "<br />");
document.write(Math.log(2) + "<br />");
document.write(Math.log(1) + "<br />");
document.write(Math.log(0) + "<br />");
document.write(Math.log(-1));
</script>
|
The output of the code above will be:
1.0000066849139877
0.6931471805599453
0
-Infinity
NaN
|
Try-It-Yourself Demos
log()
How to use log().
Complete Math Object Reference
Learn XML with <oXygen/> XML Editor - Free Trial!
|
|
oXygen helps you learn to define,
edit, validate and transform XML documents. Supported technologies include XML Schema,
DTD, Relax NG, XSLT, XPath, XQuery, CSS.
Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!
Do you have any XML related questions? Get free answers from the oXygen
XML forum
and from the video
demonstrations.
Download a FREE 30-day trial today!
|
|