我把所有内容放在括号中,但下面的代码仍然在jslint中抛出错误:
Problem at line 5 character 104: The '&&' subexpression should be wrapped in parens.
if ((typeof (c1) === 'string') && (typeof (c2) === 'string') && (c1 !== n...
Run Code Online (Sandbox Code Playgroud)
怎么修 ?
"use strict";
function t() {
var c1, c2;
if (((typeof (c1)) === 'string') && ((typeof (c2)) === 'string') && (c1 !== null) && (c2 !== null) && ((c1.trim()) === '') || ((c2.trim()) !== '')) {
return;
}
}
Run Code Online (Sandbox Code Playgroud)
它抱怨的形式if(a && b && c || d),因为(我想)这不是显而易见是否&&或||将优先考虑.修复它看起来像if(a && b && (c || d))它会停止抱怨.
| 归档时间: |
|
| 查看次数: |
1836 次 |
| 最近记录: |