'调试器'命令和JSLint [英] 'debugger' command and JSLint
本文介绍了'调试器'命令和JSLint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Google Chrome支持调试器命令作为工具在代码中设置断点。如何在 JSLint 中隐藏以下代码的警告:
/ * globals $,console,* /
/ * jslint browser:true,white:true * /
function test(){
使用strict;
调试器; // JSLint报告意外的调试器错误
$ div class =h2_lin>解决方案
JSLint有一个显式选项来容忍 debugger
语句,称为 debug
:
debug
:true 如果
调试器
语句应该被允许。
您可以通过 jslint
指令指定此选项:
/ * jslint browser:true,white:true,debug:true * /
Google Chrome supports debugger command as a tool to setup a breakpoint in code. How can I hide warnings for the following code in JSLint:
/*globals $, console, */
/*jslint browser:true, white: true */
function test() {
"use strict";
debugger; // JSLint reports the "Unexpected 'debugger'" error
}
解决方案
JSLint has an explicit option to tolerate debugger
statements, called debug
:
debug
:true
ifdebugger
statements should be allowed.
You can specify this option via your jslint
directive:
/*jslint browser:true, white: true, debug: true */
这篇关于'调试器'命令和JSLint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文