Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js check if object has property

const object1 = new Object();
object1.property1 = 42;

console.log(object1.hasOwnProperty('property1'));
// expected output: true
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #check #object #property
ADD COMMENT
Topic
Name
6+3 =