繁体   English   中英

JavaScript程序中的“输入意外结束”

[英]“Unexpected end of input” in javascript program

<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”行具有未匹配的打开括号。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM