gpt4 book ai didi

javascript - JavaScript程序中的"Unexpected end of input"

转载 作者:行者123 更新时间:2023-11-28 11:18:26 25 4
gpt4 key购买 nike

<html>
<head>
<title>
</title>

<script>
var n = 2;
var days = 365;

function factorial() {
var result = 1;
for (var i = 1; i <= n; i++) {
result *= i
}
return result;
}

var theNumber = function baseExponent (base, exponent) {
var number = 1;
for (i=0; i < exponent; i++) {
var number = base * number;
}
return number
}


document.write(factorial()*182)/(theNumber(days, n)
//i used the (formula n! * combination 365 2)/365^n
//i cheated a bit and just did the math for parts of this specific problem
</script>
</head>
<body>




</body>
</html>

我的标签收到“未捕获的语法错误:输入意外结束”,但我不明白为什么。有什么想法吗?

最佳答案

您的“document.write”行有一个不匹配的左括号。

关于javascript - JavaScript程序中的"Unexpected end of input",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9138408/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com