Prototypes

String
ƒ String() { [native code] }

String.prototype
String {’’, constructor: ƒ, anchor: ƒ, at: ƒ, big: ƒ, …}

String.proto
ƒ () { [native code] }

String.proto.proto
{constructor: ƒ, defineGetter: ƒ, defineSetter: ƒ, hasOwnProperty: ƒ, lookupGetter: ƒ, …}

so when i do
str.proto
it shows me
String {’’, constructor: ƒ, anchor: ƒ, at: ƒ, big: ƒ, …}

and when I do
str.__proto.__proto
it shows me
{constructor: ƒ, defineGetter: ƒ, defineSetter: ƒ, hasOwnProperty: ƒ, lookupGetter: ƒ, …}

but if I do
String.proto
it shows me
ƒ () { [native code] }

and not
{constructor: ƒ, defineGetter: ƒ, defineSetter: ƒ, hasOwnProperty: ƒ, lookupGetter: ƒ, …}

Why is that so?
because str inherits from the function String which in itself is an object and this String inherits from an empty object as Arnav mentioned

but then if i do
String.proto
i should get that empty object
but i get a function object
and when agaiin i do proto
only then it reaches that empty object

so when str.proto takes me to this String function object
then str.proto.proto should take me to this function ƒ () { [native code] }
but in this it doesnt happen
i am directly taken to that empty object
why is that so

Also what exactly does String.prototype do

Hi @discobot,
_proto__ is a way to inherit properties from an object in JavaScript. __proto__ a property of Object.prototype is an accessor property that exposes the [[Prototype]] of the object through which it is accessed

You can visit these for indepth understanding :

Hi! To find out what I can do, say @discobot display help.

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.