Facebook Pixel

What are the five this binding rules in JavaScript?

Default binding (plain call), implicit binding (method call), explicit binding (call/apply/bind), new binding (constructor), and lexical binding (arrow functions inherit from enclosing scope).

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in The this Keyword in JavaScript: A Complete Guide

By how the function is called, not where it is defined (except for arrow functions). Plain call: global or undefined (strict). Method call: the object. call/apply/bind: explicit. new: new object. Arrow: lexical (inherited from enclosing scope).

new binding (highest) > explicit binding (bind/call/apply) > implicit binding (method call) > default binding (plain call). Arrow functions are an exception: they use lexical this and ignore all of these rules.

Arrow functions do not have their own this. They inherit this from their enclosing lexical scope at definition time. call, apply, and bind cannot change an arrow's this. This is why arrows fix the this-in-callback bug.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.