can u explain me the diffrence between these two like in defination or some exmaple, just in a simple way
Proto and prototype
- The proto is an object within every object that points out (references) the prototype that has been set for that object.
__proto__
is the actual object that is used in the lookup chain to resolve methods, etc. - The prototype property is only present for functions and is a property that’s set only if you’re using the ‘new’ keyword when creating objects with this (constructor) function.
so if we dont use the new keyword during creating a new object then prototype is not set to that object?
Yes, It only initialises with new keyword
1 Like
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.