javascript 未捕获的 SyntaxError: 意外的输入结束

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17134903/
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-27 07:12:24  来源:igfitidea点击:

Uncaught SyntaxError: Unexpected end of input

javascriptjquery

提问by simyos

I have this code but when there's a problem and the console log this error

我有这个代码但是当出现问题并且控制台记录这个错误时

Uncaught SyntaxError: Unexpected end of input

未捕获的 SyntaxError: 意外的输入结束

$(function () {
       var clicks = 0;
      setLike('<?php echo $notrepage ?>');
      FB.Event.subscribe('edge.create', function (response) {
         if (getcookie('<? url_to_cookie($fbpage) ?>')) {
            setLike('<?php echo $autrepage;?>');
            var clicks = 1,
            cooo = <? url_to_cookie($autrepage) ?> ;
         } else if (clicks == 1) {
            setcookie(cooo, '1', 350);
            $("#inner-follow").remove();
            $("#likeplay").remove();
            document.getElementById("dsfsd").style.display = 'none';
            document.getElementById("dsfsd").style.visibility = 'hidden';
            document.getElementById("videos").style.display = 'block';
            document.getElementById("videos").style.visibility = 'visible';
            getViedo();
         } else if (clicks = 0) {
            setLike('<?php echo $fbpage; ?>');
           var  clicks = 1,
            cooo = <? url_to_cookie($fbpage); ?> ;
         }

      });

Thank you :)

谢谢 :)

回答by Sumurai8

SyntaxError: Unexpected end of inputmeans that the file ended, while the parser expected that there was more. This is usually caused by a typo, or a missing ) or }. Count the amount of opening ( and { and count the amount of ) and }. If they are not the same, you should figure out where you forgot to close them.

SyntaxError: Unexpected end of input意味着文件结束,而解析器预计还有更多。这通常是由拼写错误或缺少 ) 或 } 引起的。计算开口量(和{并计算量)和}。如果它们不相同,您应该找出忘记关闭它们的位置。

回答by ErickBest

You must be mising either a }or )or both something like })

您必须mising无论是})或两者类似})