Home > Web Front-end > JS Tutorial > 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
Release: 2016-05-16 15:55:11
Original
1568 people have browsed it

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

Math.exp( x ) ;

Copy after login

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>

Copy after login

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 

Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template