编程语言
首页 > 编程语言> > javascript – 如何修复jslint’\u0026\u0026’子表达式应该包含在parens错误中

javascript – 如何修复jslint’\u0026\u0026’子表达式应该包含在parens错误中

作者:互联网

我把所有内容放在括号中但是下面的代码仍然在jslint中抛出错误:

Problem at line 5 character 104: The '&&' subexpression should be wrapped in parens.

if ((typeof (c1) === 'string') && (typeof (c2) === 'string') && (c1 !== n...

怎么修 ?

"use strict";

function t() {
    var c1, c2;
    if (((typeof (c1)) === 'string') && ((typeof (c2)) === 'string') && (c1 !== null) && (c2 !== null) && ((c1.trim()) === '') || ((c2.trim()) !== '')) {
        return;
    }
}

解决方法:

它抱怨表格if(a&& b& c || d)因为(我想)并不是很明显是否&&或||将优先考虑.将其修改为如果(a&& b&&(c || d))并且它将停止抱怨.

标签:javascript,jslint
来源: https://codeday.me/bug/20191006/1862873.html