How 'this' Works in JavaScript: Decided by the Call, Not the Code
'this' in JavaScript depends on how a function is called, not where it's written. Four rules and one arrow-function exception cover every case.
3 min read

'this' in JavaScript depends on how a function is called, not where it's written. Four rules and one arrow-function exception cover every case.

A JavaScript class is a function with stricter rules. Learn the three rules it adds and why this.constructor lets an object reach its own class.
