Skip to content

Instantly share code, notes, and snippets.

@fijiwebdesign
Created June 28, 2016 23:45
Show Gist options
  • Save fijiwebdesign/b25bf2003bd25fa39db0164f913671df to your computer and use it in GitHub Desktop.
Save fijiwebdesign/b25bf2003bd25fa39db0164f913671df to your computer and use it in GitHub Desktop.
JS local object properties test
// test local and inherited properties of an object
var obj = { name: 'test' };
console.log(obj.name); // 'test'
console.log(obj.hasOwnProperty('name')); // true
obj.__proto__.age = 10000; // hack to make age an inherited property
console.log(obj.age); // 10000
console.log(obj.hasOwnProperty('age')); // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment