JavaScript EXP 函数是一个 Math 函数,用于计算 E 的幂,其中 E 是欧拉数,约等于 2.71828。math exp 函数的语法是:
Math.exp(number);
如果 number 参数不是数字,exp 函数将返回 NaN。如果它是 Null,此函数会将 Null 值转换为 Zero。
exp 函数示例
在此 exp 函数示例中,我们将使用不同的数据类型进行检查并显示输出。请参阅 JavaScript 文章。
<!DOCTYPE html>
<html>
<head>
<title> JavaScriptExponentialFunction </title>
</head>
<body>
<h1> JavaScriptExponentialFunction </h1>
<p id = "Pos"></p>
<p id = "Neg"></p>
<p id = "Dec"></p>
<p id = "Neg_Dec"></p>
<p id = "Str"></p>
<p id = "Exp"></p>
<p id = "Null"></p>
<p id = "Multi"></p>
<script>
document.getElementById("Pos").innerHTML = Math.exp(1);
document.getElementById("Neg").innerHTML = Math.exp(-1);
document.getElementById("Dec").innerHTML = Math.exp(10.45);
document.getElementById("Neg_Dec").innerHTML = Math.exp(-6.45);
document.getElementById("Str").innerHTML = Math.exp("JavaScript");
document.getElementById("Null").innerHTML = Math.exp(null);
document.getElementById("Multi").innerHTML = Math.exp(2 + 5 - 5);
</script>
</body>
</html>
