クロムでは、
(function(){}).__proto__
は
function Empty() {}
だから私は期待していたでしょう
new Function();
であるがfunction Empty() {}
、代わりにそうであるfunction anonymous() {}
。
どこで見つけることができますfunction Empty() {}
か? それは中Function
かObject
どこかにありますか?
クロムでは、
(function(){}).__proto__
は
function Empty() {}
だから私は期待していたでしょう
new Function();
であるがfunction Empty() {}
、代わりにそうであるfunction anonymous() {}
。
どこで見つけることができますfunction Empty() {}
か? それは中Function
かObject
どこかにありますか?
これらの名前は、それらの識別子でアクセスできるという意味ではありません。
関数のプロトタイプは起動時に名前が設定されます。.name
その関数には名前が設定されていますが、実際にはそれを公開して公開する以外の目的はありません.toString()
。
例として、名前はnew Function()
単に. 空の文字列も同様です。繰り返しますが、それはあまり目的を果たしません。.toString()
.name
空の関数オブジェクト (名前はEmpty
) は、 のプロトタイプですFunction
。
Function.prototype.toString() === "function Empty() {}"
Object.getPrototypeOf(new Function()).toString() === "function Empty() {}"
Empty は Function のプロトタイプの名前です。Chrome コンソールから:
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