开发者

How to fix JSLint "missing new" error

开发者 https://www.devze.com 2023-04-08 05:29 出处:网络
Code below passed through JS开发者_如何学CLint causes an error: Problem at line 8 character 9: Missing \'new\'.

Code below passed through JS开发者_如何学CLint causes an error:

Problem at line 8 character 9: Missing 'new'.

ResizeGrid();

How to fix?

"use strict";

var ResizeGrid;

function t() {
    var x;
    if (x) {
        ResizeGrid();
    }
}


Tick Tolerate uncapitalized constructors or rename to resizeGrid(); to prevent lint from assuming its a function constructor (although calling an undefined var like that will raise other errors).


You should name functions with a lower case initial letter, unless they are intended as constructors. If they are intended as constructors, you should be calling them with new.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号