Home  >  Article  >  Web Front-end  >  Introduction to using the exponential method Math.exp() in JavaScript_Basic knowledge

Introduction to using the exponential method Math.exp() in JavaScript_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 15:55:111533browse

This method returns Ex, where x is the parameter and E is the Euler-invariant, base of natural logarithms.
Grammar

Math.exp( x ) ;

Here are the details of the parameters:

  • x : a number.

Return value:

  • Returns the exponent value of variable x

Example:

<html>
<head>
<title>JavaScript Math exp() Method</title>
</head>
<body>
<script type="text/javascript">

var value = Math.exp(1);
document.write("First Test Value : " + value ); 
 
var value = Math.exp(30);
document.write("<br />Second Test Value : " + value ); 

var value = Math.exp(-1);
document.write("<br />Third Test Value : " + value ); 

var value = Math.exp(.5);
document.write("<br />Fourth Test Value : " + value ); 
</script>
</body>
</html>

This will produce the following results:

First Test Value : 2.718281828459045
Second Test Value : 10686474581524.462
Third Test Value : 0.36787944117144233
Fourth Test Value : 1.6487212707001282 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn