자바 스크립트 뒤에있는 프로토 타입을 더 잘 이해하기 위해 다음과 같은 것을 발견했습니다. 지금까지는 이해할 수 없었습니다.Function.prototype.propertyname === Object.propertyname이 true입니까?
나는 기능은 제 클래스 객체 것으로 알고 있습니다,하지만 난하지 착각 같이 Function.prototype이 인입니다 경우 개체 같이 Function.prototype
Function.prototype.foo = 'bar';
Object.foo // Object now has this property and returns 'bar'
Object.foo === Function.prototype.foo // returns true
그리고 여기 나는 Object가 객체라고 생각했습니다. 이것으로 해결됩니다. 고마워요! –
@ChrisM :'Object' *는 객체입니다. 'Object instanceof Object; // true'보다 구체적으로, 그것은'Function' 객체입니다. '객체 instanceof 함수; // true'. 자바 스크립트에서 함수는 객체입니다. –