欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

使用jslint的时候老是提示Problem at line 1 character 1: Missing "use strict" statement如何解决?

shiping1 的头像

今天正好碰到这个问题,解决方法也很简单,具体可以参考这里:
http://stackoverflow.com/questions/1335851/what-does-use-strict-do-in-javascript-and-what-is-the-reasoning-behind-it
代码如下:

  1. // Non-strict code...
  2.  
  3. (function(){
  4.   "use strict";
  5.  
  6.   // Define your library strictly...
  7. })();
  8.  
  9. // Non-strict code...
评论 (2)  链接 • 2012-08-31
  • 0
    提示该错误的原因是啥?为什么要这么做呢?求教。 – 十痞子十 2013-06-16
  • 0
    加入 use strict 后,java解析器将使用严格的语法来解析代码,帮助开发人员发现错误。
    如 a = 1; //报错 因为没有事先定义
    再如 对象中属性重复定义也会报错 等等
     – 好少年巴鲁 2013-07-28

    来自  http://www.dewen.org/q/3617
普通分类: