Sunday, September 2, 2018

javascript - Is there any way to distinguish between an unset property and a property set to undefined?

hasOwnProperty() method returns a boolean indicating whether the object has the specified property as own (not inherited) property.


In given case -


  testObject = {a: undefined};
testObject.hasOwnProperty('a') //true
testObject.hasOwnProperty('b') //false

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...