How to fix JSLint “missing new” error

前端 未结 2 1985
无人共我
无人共我 2021-02-19 01:56

Code below passed through JSLint causes an error:

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

ResizeGrid();

How to fix?

<
相关标签:
2条回答
  • 2021-02-19 02:18

    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 讨论(0)
  • 2021-02-19 02:22

    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).

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