Js when the prototype of a function is undefined

Why is Object.prototype.toString.prototype undefined

Object.prototype.toStringFunction

Daily thinking

 Object.prototype.toString.prototype  //undefined

questions

all functions have prototype, but why is it undefined in the example? And undefined is not an object

there is a saying on javascript that you don"t know: all functions have a public and non-enumerable property named prototype by default.
so I"m curious, and for example, Math.max doesn"t have a prototype attribute

.
Aug.02,2021
The

Object object itself is a function object, so it has a prototype property, and the value of Object.prototype is an empty object {}.
in addition, when you get the prototype of Object through Object.prototype.__proto__, you will get null, that is, the prototype object {} is the end of the prototype chain.


all functions have a public and non-enumerable property named prototype by default

this sentence can not be wrong, it can only be counted as unfinished. The default is true, but prototype is just a common property that can be set artificially, and _ _ proto__ is inherited (although it can also be modified).

prototype exists because it can be copied to the _ proto__ of the generated object when function is used as a constructor ( new or super ). For some internal methods, it is clear that they are not constructor, so it is reasonable not to have prototype (and no [[Construct]] internal attribute).

for more information, see Specification :

Built-in functions that are not constructors do not have a prototype property unless otherwise specified in the description of a particular function.

all functions have prototype


try it on the console, there is no prototype.

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bf20-2c2c9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bf20-2c2c9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?