Oops, All Code!/📝 Study Notes

[JS] 일반 객체와 함수 객체의 차이

밍동망동 2023. 3. 14. 00:00

일반 객체는 호출이 불가하다.

하지만 함수 객체는 호출이 가능하다.

 

더불어 함수 객체는 함수 고유의 프로퍼티를 소유한다.

 

브라우저 콘솔에서 console.dir 메서드를 이용하면 확인할 수 있다.

 

console.dir() - Web APIs | MDN

The method console.dir() displays an interactive list of the properties of the specified JavaScript object. The output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects.

developer.mozilla.org

console.dir

 

add 함수의 모든 프로퍼티 어트리뷰트는 Object.getOwnPropertyDescriptors로 확인할 수 있다.

 

기록된 arguments, caller, length, name, prototype 프로퍼티는 모두 데이터 프로퍼티다.

이 프로퍼티는 함수 객체 고유의 프로퍼티다.

 

해당 프로퍼티에 대해서는 다음 포스팅에 차례로 서술하겠다.