[英]Expected an assignment or function call and instead saw an expression
I am using JSLint to ensure my JavaScript is "strict" and I'm getting the following error: Expected an assignment or function call and instead saw an expression 我正在使用JSLint来确保我的JavaScript是“严格的”并且我收到以下错误:期望一个赋值或函数调用而是看到一个表达式
On the following code: if(index>0){ shakStaute===1; }
在以下代码中:
if(index>0){ shakStaute===1; }
if(index>0){ shakStaute===1; }
JSLint is flagging up that shakSuite===1;
JSLint正在标记
shakSuite===1;
is a pointless statement. 是一个毫无意义的陈述。 The only thing it does is evaluate the variable
shakSuite
, compare its value with 1
, and then throw away the result of the comparison. 它唯一做的是评估变量
shakSuite
,将其值与1
进行比较,然后丢弃比较结果。 It doesn't do anything else. 它没有做任何其他事情。
If your goal is to set shakSuite
to the value 1
, you want =
(assignment), not ===
(strict equality comparison): 如果您的目标是将
shakSuite
设置为值1
,则需要=
(赋值),而不是===
(严格相等比较):
if (index > 0) {
shakSuite = 1;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.