How to disable the Weird Condition check in JSLint?

天涯浪子 提交于 2019-12-02 10:20:51

Two thoughts:

1) You can make the linter happy by adding this comment at the top of the file: /*jshint eqeqeq: true */ That said, I still get a This 'switch' should be an 'if'. warning. It may be that jslint/jshint just won't ignore this kind of construct.

2) Instead of turning of linter options, I would respectfully suggest that you take this opportunity to clean up rather strange code and rewrite your switch as follows:

var k = window.event.keycode;

if(k === 9) {
       //
} else if(k === 13) {
       //
} else if(k === 38 && selectedRecord > 1) {
       //
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!