“alert” is not defined when running www.jshint.com

后端 未结 8 1848
长发绾君心
长发绾君心 2020-12-15 02:46

I fixed this by simply adding var alert; However, is this what I should be doing to get the pesky error message to go away? Here is the fix. Here is the fail

相关标签:
8条回答
  • 2020-12-15 03:15

    This documentation says the following about the browser option:

    This option defines globals exposed by modern browsers: all the way from good ol' document and navigator to the HTML5 FileReader and other new developments in the browser world. Note: this option doesn't expose variables like alert or console. See option devel for more information.

    and the following about the devel option:

    This option defines globals that are usually used for logging poor-man's debugging: console, alert, etc. It is usually a good idea to not to ship them in production because, for example, console.log breaks in legacy versions of Internet Explorer.

    You have browser enabled and devel disabled. You can control these with checkboxes under "Assume" on the jshint original page. I also recommend heeding the warning in the documentation ;-)

    0 讨论(0)
  • 2020-12-15 03:19

    Set "devel:true" in the Options. This enables things like Alert, console, etc.

    See documentation here: http://jshint.com/docs/options/

    0 讨论(0)
提交回复
热议问题