Skip to content

Instantly share code, notes, and snippets.

@timkelty
Last active August 29, 2015 14:17
Show Gist options
  • Save timkelty/98461fc3d683477e37bf to your computer and use it in GitHub Desktop.
Save timkelty/98461fc3d683477e37bf to your computer and use it in GitHub Desktop.

Where's my prototype?

var a = {foo: 'bar'};
var b = Object.create(a);
console.log(a);
console.log(b);
console.log(b.prototype);
console.log(b.constructor.prototype);

Output

Node (v0.10.33)

{foo: "bar"}
{}
undefined
{}

Browser (Chrome 41.0.2272.89, Firefox 36)

{foo: "bar"}
{foo: "bar"}
undefined
{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment