log() Math class methodS2C Home
« Globals « Math « log()
Description
Returns the natural logarithm of a number (base E).
- Like all class methods
log()should be used on the class rather than an instance of the class.
Syntax
| Signature | Description |
|---|---|
Math.log(value) | Returns the natural logarithm of a number (base E). |
Parameters
| Parameter | Description |
|---|---|
value | The value you wish to find the log() of:
|
Examples
The code below displays log() usage.
/*
* Store results in an array.
*/
var logValues = new Array(5);
logValues[0] = Math.log(-1);
logValues[1] = Math.log(0);
logValues[2] = Math.log('0.75');
logValues[3] = Math.log('a string');
logValues[4] = Math.log();
logValues[5] = Math.log(null);
alert(logValues);
Related Tutorials
JavaScript Advanced Tutorials - Lesson 4 - Math