자바스크립트 hasOwnProperty()

1 개요[ | ]

자바스크립트 hasOwnProperty()
var x = {first:1, second:4};
console.log( Object.prototype.hasOwnProperty.call(x, 'first') ); // true
console.log( Object.prototype.hasOwnProperty.call(x, 'thrid') ); // false
var x = {first:1, second:4};
console.log( x.hasOwnProperty('first' ) ); // true
console.log( x.hasOwnProperty('thrid' ) ); // false
let x = {first:1, second:4};
console.log( 'first' in x ); // true
console.log( 'third' in x ); // false
let x = {first:1, second:4};
console.log( !('first' in x) ); // fasle
console.log( !('third' in x) ); // true

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}