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

时间:2012-02-04 04:27:35

标签: javascript factorial

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

我的标签出现了“未捕获的语法错误:意外的输入结束”,我无法弄清楚原因。有什么想法吗?

1 个答案:

答案 0 :(得分:10)

你的“document.write”行有一个无与伦比的开放表。