JSLint Error: Unexpected 'this'

jdw picture jdw · May 19, 2015 · Viewed 17.1k times · Source

Having trouble understanding why JSLint is surprised by my use of this in the following code:

For both property assignments, JSLint says: Unexpected 'this'. How do I correct my code?

Answer

Oriol picture Oriol · May 19, 2015

Your code might be perfectly correct (it might also be problematic, depending on how you call testConstr).

My suggestion is: tell JSLint to shut up

enter image description here

Or don't use JSLint at all.