hasOwnProperty

es버전
Tags
속성
테스트
bool
비고
객체가 특정 속성을 갖고 있는지 검사
obj.hasOwnProperty(prop)
const object1 = {}; object1.property1 = 42; console.log(object1.hasOwnProperty('property1')); // expected output: true console.log(object1.hasOwnProperty('toString')); // expected output: false console.log(object1.hasOwnProperty('hasOwnProperty')); // expected output: false