“Use the array literal notation []” for var os_map = {}

后端 未结 4 1096
梦毁少年i
梦毁少年i 2021-01-02 03:56

I don\'t understand why I get the error message when I run JSLint with a JavaScript file.

I get the message var os_map = {}; Problem at line 28 character 36: Us

4条回答
  •  甜味超标
    2021-01-02 04:05

    My read of line 28 in that code is:

    var os_autoload_forms = new Array('searchform', 'searchform2', 'powersearch', 'search' );
    

    ...where it would indeed be appropriate to use the literal array syntax:

    var os_autoload_forms = ['searchform', 'searchform2', 'powersearch', 'search' ];
    

    It should be saying the same thing about line 27, though.

提交回复
热议问题