Function
A function is an object, and the object representing a function is a function object. All function objects are constructed by Function function object. In other words, Function is the top-level constructor. It constructs all objects in the system, including user-defined objects, built-in objects in the system, and even itself.
Object
Object is the top-level object, and all objects will inherit the Object prototype. You should also know that Object is also a function object, so Object is constructed by Function.
Function and Object relationship diagram:
The code copy is as follows:
<script type="text/javascript">
var Foo= function(){}
var f1 = new Foo();
console.log(f1.__proto__ === Foo.prototype);
console.log(Foo.prototype.constructor === Foo);
var o1 =new Object();
console.log(o1.__proto__ === Object.prototype);
console.log(Object.prototype.constructor === Object);
console.log(Foo.prototype.__proto__ === Object.prototype);
//Function and Object
console.log(Function.__proto__ === Function.prototype);
console.log(Object.__proto__ === Function.prototype);
console.log(Object.prototype.__proto__);
console.log(Object.__proto__ === Function.prototype);
</script>
When reading the code, you can refer to the relationship diagram in the picture below. I hope you like it.