Best part of the post:
When working with
this
, remember the following rules:- It’s set based on how a function is called:
new MyConstructor
ormyObject.method()
will refer to an instance, whilethis
inside a function refers to the global context - Strict mode causes
this
to evaluate toundefined
instead of the global context inside functions this
can be referenced by a variable, andself
is the conventionally used name
No comments:
Post a Comment