Js Under what circumstances is the prototype of a function undefined

  javascript

Why is prototype undefined?

Object.prototype.toString is a Function type, then why and how can there be no prototype

Daily thinking

Object.prototype.toString.prototype  //undefined

Doubt

All functions have prototype, but why is 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 unenumerable attribute named prototype by default.
So I’m curious, and Math.max, for example, has no prototype attribute

By default, all functions have a public and enumerable property named prototype

This sentence can’t be said wrong, can only calculate words haven’t finished. “Default” is indeed the case, butprototypeIt is just a common attribute that can be set manually.__proto__Is inherited (although can also be modified).

prototypeThe meaning of existence is that when function is used as a constructor (NewOrSuperThe that can be copied to the build object__proto__Go. For some internal methods, it is definitely not as a constructor, so there is no.prototypeIs very reasonable (at the same time also have no.[[Construct]]Internal attributes).

For a detailed reading, seeSpecification:

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