当前位置: 移动技术网 > IT编程>开发语言>JavaScript > JavaScript中使用指数方法Math.exp()的简介

JavaScript中使用指数方法Math.exp()的简介

2019年08月02日  | 移动技术网IT编程  | 我要评论

 此方法返回 ex, 其中x是参数,e是欧拉不变,自然对数的底数。
语法

math.exp( x ) ;

下面是参数的详细信息:

  •     x : 一个数字.

返回值:

  • 返回变量x的指数值

例子:

<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>

这将产生以下结果:

first test value : 2.718281828459045
second test value : 10686474581524.462
third test value : 0.36787944117144233
fourth test value : 1.6487212707001282 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网