Created
January 22, 2014 21:41
-
-
Save steven-ferguson/8567906 to your computer and use it in GitHub Desktop.
Object.create vs new Object with object literal notation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Foo = { | |
prop: 'A' | |
} | |
var bar = Object.create(Foo); | |
var bad = new Object(Foo); | |
//These are false | |
console.log(Foo === bar); | |
console.log(bar === bad); | |
//But this is true | |
console.log(Foo === bad); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment