Skip to content

Instantly share code, notes, and snippets.

@pkrumins
Created July 9, 2010 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkrumins/468982 to your computer and use it in GitHub Desktop.
Save pkrumins/468982 to your computer and use it in GitHub Desktop.
node> o = { foo : 'bar' }
{ foo: 'bar' }
node> Object.defineProperty(o, 'moo', { value : 'cows', enumerable: false })
{ foo: 'bar' }
node> Object.keys(o)
[ 'foo' ]
node> o.moo
'cows'
node> Object.getOwnPropertyDescriptor(o, 'moo')
{ value: 'cows'
, writable: false
, enumerable: false
, configurable: false
}
node> Object.getOwnPropertyDescriptor(o, 'foo')
{ value: 'bar'
, writable: true
, enumerable: true
, configurable: true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment