Horje
JavaScript does not protect the property name hasOwnProperty Code Example
JavaScript does not protect the property name hasOwnProperty
// hasOwnProperty – JavaScript does not protect
var foo = {
    // overriding foo's default hasOwnProperty method
    hasOwnProperty: function() {
        return false;
    },
    bar: 'data'
};
foo.hasOwnProperty('bar'); // false always

// Hence, to prevent this, use Object.prototype.hasOwnProperty as follows-
Object.prototype.hasOwnProperty.call(foo, 'bar'); // true




Javascript

Related
equivalent of useHistory in react Code Example equivalent of useHistory in react Code Example
javascript check if date is less than today Code Example javascript check if date is less than today Code Example
best javascript video in hindi Code Example best javascript video in hindi Code Example
jquery insert text into input Code Example jquery insert text into input Code Example
run forset Code Example run forset Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11