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 –
我想知道每个函数如何获得其内部属性和方法,如原型,调用,绑定等 –