Where is the function Empty () {}?

In Chrome,

(function(){}).__proto__ 

is an

 function Empty() {} 

so i would expect

 new Function(); 

will be function Empty() {} , but instead it is function anonymous() {} .

Where can I find function Empty() {} ? Is it somewhere in Function or Object ?

+4
source share
3 answers

These names do not mean that you can access them with these identifiers.

As for the function prototype, the name is set at startup . This function has been set to a name, but in fact it is not intended for purposes other than .name and .toString() that display it.

As for the new Function() instance, the name is just printed for .toString() . So .name is still an empty string. Again, this is not very important.

+6
source

An empty function object (whose name is Empty ) is a prototype of Function .

 Function.prototype.toString() === "function Empty() {}" Object.getPrototypeOf(new Function()).toString() === "function Empty() {}" 
+6
source

The empty name of the function prototype. On the Chrome console:

 dir(Function) function Function() { [native code] } arguments: null caller: null length: 1 name: "Function" prototype: function Empty() {} __proto__: function Empty() {} apply: function apply() { [native code] } arguments: null bind: function bind() { [native code] } call: function call() { [native code] } caller: null constructor: function Function() { [native code] } length: 0 name: "Empty" toString: function toString() { [native code] } __proto__: Object 
+2
source

All Articles