Please consider the following code.
The following is according to JSLint or JSHint perfectly valid Javascript code:
function fun() {
"use strict";
var myvar = "";
myvar.foo();
}
The following not:
function fun() {
"use strict";
var myvar = "";
foo();
}
Why is JSLint (or JSHint) not detecting that myvar.foo() wasn't declared before, whereas it detects that foo() wasn't declared? Is there an option which I'm missing?
I would like those types of errors to be detected upon validation. Is there another javascript tool which can detect the use of undeclared properties or methods inside an object as explained in the examples above?