Skip to content

Instantly share code, notes, and snippets.

@daifu
Created July 24, 2012 02:07
Show Gist options
  • Save daifu/3167519 to your computer and use it in GitHub Desktop.
Save daifu/3167519 to your computer and use it in GitHub Desktop.
javascript hasOwnProperty for object
if ( !Object.prototype.hasOwnProperty ) {
Object.prototype.hasOwnProperty = function(prop) {
var proto = obj.__proto__ || obj.constructor.prototype;
return (prop in this) && (!(prop in proto) || proto[prop] !== this[prop]);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment