bhaiya differnce between proto and prototype i did nit ubderstand in it
Bhaiya differnce between proto and prototype i did nit ubderstand in it
You can read it here https://stackoverflow.com/questions/9959727/proto-vs-prototype-in-javascript#:~:text=30%20Answers&text=prototype%20is%20a%20property%20of,object%2C%20pointing%20to%20its%20prototype.
i followed the link you shared but did not get it will u please expalin this in layman language . i have lot of confusion in this .
Yes, sure.
When we say “prototype”, it is a property of the function. i.e. if we have a function Abc(), then the prototype can be accessed using Abc.prototype
function Abc() {
//code
}
console.log(Abc.prototype)
This is similar to how a js object has properties. If we have an object x, then we can access its properties (say ‘a’)
x = {
a: 3
}
Abc.prototype is a similar property, but on a function.
When we create a new object using this function, i.e.
obj = new Abc()
then we can access the same prototype (that we discussed above) using this new object also, using obj.__proto __
bhaiya one last doubt ki jab main String.prototype likhta hu then fir iski properties aa jaati hai lekin jab main koi string bnata hu like let str= “apple” and jab mai ispr str.proto krta hu then wo seedha object se inherit hota hai but basically mera bnaya str toh pehle object ke constructr jisme string ki properties defined hui hai wha se inherit hona chaiye them fr object se plzz elaborate this proto chain
I didn’t understand your query. Ek baat elaborate karke batana…
ispr str.__proto__ krta hu then wo seedha object se inherit hota hai but basically mera bnaya str toh pehle object ke constructr jisme string ki properties defined hui hai wha se inherit hona chaiye
This part.
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.