Math Object
The Math Object
The Math Object provides you different methods and properties which allows us to perform mathematical tasks on numbers.
Property |
Description |
---|---|
E |
Euler’s Constant |
LN2 |
Natural log of value 2 |
LN10 |
Natural log of value 10 |
LOG2E |
Base 2 log of E |
LOG10E |
Base 10 log of E |
PI |
Return the constant PI |
Code:
<html>
<body>
<h2>JavaScript Math Object</h2>
<script>
document.write(Math.PI);
</script>
</body>
</html>
Output: