Sample Code:
const object1 = { ‘test1’ : ‘testing’};
console.log( object1.hasOwnProperty( ‘test1’ ) );
console.log( object1.hasOwnProperty( ‘test2’ ) );
console.log( object1.hasOwnProperty( ‘test1’ ) );
console.log( object1.hasOwnProperty( ‘test2’ ) );
Output:
true
false