简体   繁体   English

期望一个赋值或函数调用,而是看到一个表达式

[英]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.

相关问题 期望赋值或函数调用,而是看到了一个表达式 - Expected an assignment or function call and instead saw an expression 期望一个赋值或函数调用,而是看到一个表达式? - Expected an assignment or function call and instead saw an expression? return function returning预期的赋值或函数调用,而是看到一个表达式 - return function returning Expected an assignment or function call and instead saw an expression 期望赋值或函数调用,但在函数中看到表达式错误 - Expected an assignment or function call and instead saw an expression error in function Javascript:JSHint:需要一个赋值或函数调用,而是看到一个表达式 - Javascript: JSHint: Expected an assignment or function call and instead saw an expression 错误-预期分配或函数调用,而是看到一个表达式 - Error - Expected an assignment or function call and instead saw an expression ReactJS错误:“预期分配或函数调用,而是看到了一个表达式” - ReactJS error: “Expected an assignment or function call and instead saw an expression” 警告带有主干的JSHint:预期分配或函数调用,而是看到一个表达式 - Warning JSHint with backbone : Expected an assignment or function call and instead saw an expression 错误:预期分配或函数调用,而是看到一个表达式 - Error: expected an assignment or function call and instead saw an expression 期望一个赋值或函数调用,而是在定义接口时看到一个表达式 - Expected an assignment or function call and instead saw an expression when defining interface
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM