简体   繁体   English

JSlint中的验证错误

[英]Validation error in JSlint

I am having some troubles. 我有一些麻烦。 We had an assignment in the JavaScript class that I am taking to create a game of Hangman using module pattern. 我们在JavaScript类中分配了一个任务,我将使用模块模式来创建Hangman游戏。

I have succeeded with making it function, however, my code does not pass the Jslint validation test. 我已经成功实现了它的功能,但是,我的代码未通过Jslint验证测试。 It keeps giving me one error and I have no idea how to get rid of it. 它一直给我一个错误,我不知道如何消除它。

Read below what it says. 请阅读下面的内容。 hangman.js: line 221, col 30, Expected an assignment or function call and instead saw an expression. hangman.js:第221行,第30行,应该是一个赋值或函数调用,而是看到一个表达式。

I have tried to remove everything on line 221 but then my code does not work anymore. 我试图删除221行上的所有内容,但随后我的代码不再起作用。 Please help me. 请帮我。

line 221 hangman.wrongCount = 0;

Here is a link to a fiddle in which I have put all my code. 这是我在其中输入了所有代码的小提琴的链接。 And note, it is ONLY line 221 in the javascript that is creating problem, the rest you can ignore. 请注意,正是javascript中的221行造成了问题,其余的您可以忽略。

Link to fiddle: http://jsfiddle.net/1nvaahyv/ 链接到小提琴: http : //jsfiddle.net/1nvaahyv/

Thanks in advance! 提前致谢!

The problem lies in the preceding line (note the comma): 问题出在前一行(请注意逗号):

    hangman.guessedLetters = [],
    hangman.wrongCount = 0;

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

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