JSLint Error: Unexpected 'this'

后端 未结 6 1510
野趣味
野趣味 2020-12-03 01:02

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

6条回答
  •  失恋的感觉
    2020-12-03 01:16

    An old question I know, but in case it helps anyone, I was watching a talk by Douglas Crockford in which he says (at about 23mins) that he took it out because an attacker could run a method as a function and get access to the global scope with the 'this' keyword.

    He says it also meant not using Object.create anymore either - a feature he helped introduce to the language!

提交回复
热议问题