All About “new” Keyword…

Abvhishek kumar
1 min readMar 8, 2022

--

Rules to find the value of this

1) Is the function called with new keyword, then this will point to brand new object

2) Is the function called with call,bind,apply ,if yes, then this will point to the passed object

3) If the function is called on object, then this will be point to the object obj.fn()

4) directly function call ,then this will be point to the window obj or undefined based on usage of “use strict”

Note: In Arrow function there is no this . Value of this is calculated lexically

  • 👏 Clap for the Story and Follow the Author
  • Show your appreciation for the author’s insightful content.
  • Follow Abhishek Kumar.
  • 📰 Explore More in the Abhishek Kumar Publication
  • 🔔 Stay Connected on Social Media
  • Stay updated on the latest discussions and content by following Level Up Coding on Twitter and connecting on LinkedIn.

--

--

Abvhishek kumar
Abvhishek kumar

Written by Abvhishek kumar

A React Native front-end developer & freelance engineer from New Delhi, India, passionate about elegant interfaces & top-notch code.

No responses yet