InterviewSolution
Saved Bookmarks
| 1. |
What Is The Difference Between A Constructor Function And A Non-constructor Function With Respect To The Word “this” ? |
|
Answer» In a non-constructor function, “this” REFERS to the GLOBAL context or if the function is a method, it refers to the object to which the method belongs. In the INSTANCE object that is RETURNED by a constructor function, “this” refers to the instance object itself. In a non-constructor function, “this” refers to the global context or if the function is a method, it refers to the object to which the method belongs. In the instance object that is returned by a constructor function, “this” refers to the instance object itself. |
|