JavaScript math log() method

The JavaScript math log() method is used to get the natural logarithm of a number.
Syntax:

Math.log(n)

Parameters
n: It represents the number whose logarithm has to be obtained.

Returns
The logarithm of a number

Example:

<!DOCTYPE html>
<html>
<body>
<script>
document.writeln(Math.log(2));
</script>
</body>
</html>