16

Code below passed through JSLint 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();
    }
}
Community
  • 1
  • 1
Andrus
  • 26,339
  • 60
  • 204
  • 378

2 Answers2

28

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

Alex K.
  • 171,639
  • 30
  • 264
  • 288
5

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.

rjmunro
  • 27,203
  • 20
  • 110
  • 132