Math.log
Math.log
Function
Specifies the base logarithm. Returns the logarithm of value in base.
Syntax
Math.log(value, base)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| value | Number | is | None | a true number. |
| base | Number | Yes | None | The base. |
Return value
| Type | Description |
|---|---|
| Int/Float | Returns the base logarithm of value. An Int is returned for integer results, and a Float for non-integer or non-finite results. |
Example
result = Math.log(8, 2) // Output: 3 print result
Notes
- An error will be reported if base is missing.