- Given...

function f(x, y) {

'use strict';

var t = x;

return function (z) {

console.log(x + y + t + z);

};

}

... JSLint reports:

f(x, y)

closure

t, x

Should y also be reported as a closure variable? - --- In jslint_com@yahoogroups.com, "quintic" <nick_hobson@...> wrote:

> Given...

Thanks. Please try it now.

>

> function f(x, y) {

> 'use strict';

> var t = x;

> return function (z) {

> console.log(x + y + t + z);

> };

> }

>

> ... JSLint reports:

>

> f(x, y)

> closure

> t, x

> Should y also be reported as a closure variable?

- --- In jslint_com@yahoogroups.com, "douglascrockford" <douglas@...> wrote:
>

That was fast -- thanks! It now reports t, x, y as closure variables.

> --- In jslint_com@yahoogroups.com, "quintic" <nick_hobson@> wrote:

>

> > Given...

> >

> > function f(x, y) {

> > 'use strict';

> > var t = x;

> > return function (z) {

> > console.log(x + y + t + z);

> > };

> > }

> >

> > ... JSLint reports:

> >

> > f(x, y)

> > closure

> > t, x

> > Should y also be reported as a closure variable?

>

> Thanks. Please try it now.

>