https://danmartensen.svbtle.com/the-anatomy-of-a-javascript-function#creating-function-instances_3如何創建JavaScript函數對象,並得到他們的內部屬性
我試圖理解本文就如何創建JavaScript函數對象。 它說:在上面的語句
The new instance object is implicitly assigned many internal properties, one being the [[prototype]] property. The Function constructor’s prototype property referencing it’s prototype object is copied into this new object’s [[prototype]] property
立足我寫了這個代碼:
function Person(){
}
console.dir(Function.prototype);
console.dir(Person.prototype);
根據聲明Function.prototype的被分配到一個新創建的函數對象的prototpe(Person.prototype的在這種情況下)。我打印了他們兩個。內容看起來不同。
有人可以解釋我的理解出錯的地方。當我看着的ECMAScript規範以及方式,它具有相同的聲明
根據JavaScript函數是對象。即使Ecmascript調用相同http://www.ecma-international.org/ecma-262/5.1/#sec-13.2 –
我想知道每個函數如何獲得其內部屬性和方法,如原型,調用,綁定等 –