javascript javascript程序中的“意外输入结束”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9138408/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 05:42:17 来源:igfitidea点击:
"Unexpected end of input" in javascript program
提问by Nic Meiring
<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>
i am getting an "Uncaught syntax error: unexpected end of input" for my tag and I can't figure out why. Any ideas?
我的标签收到“未捕获的语法错误:意外的输入结束”,我不知道为什么。有任何想法吗?
回答by Mu Mind
Your "document.write" line has an unmatched open paren.
您的“document.write”行有一个无与伦比的开放括号。