객체 프로퍼티

    [JavaScript] 객체 프로퍼티와 메소드

    객체 프로퍼티(property) 모든 자바스크립트 객체는 Object 객체와 Object.prototype 객체의 모든 프로퍼티를 상속받는다. prototype 프로퍼티를 이용하면 현재 존재하는 프로토타입에 새로운 프로퍼티나 메소드를 손쉽게 추가할 수 있다. 객체 메소드(method) 모든 자바스크립트 객체는 Object 객체와 Object.prototype 객체의 모든 프로퍼티와 메소드를 상속받는다. 자주 사용되는 대표적인 객체 메소드는 다음과 같다. hasOwnProperty() propertyIsEnumerable() isPrototypeOf() isExtensible() toString() valueOf() hasOwnProperty() 메소드 hasOwnProperty() 메소드는 특정 프로퍼티..