Last active
August 29, 2015 14:15
-
-
Save daytonn/3c88d1d996d2e919ef3b to your computer and use it in GitHub Desktop.
CWCPOOJS - bad instantiation
This file contains 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
function Person(attributes) { | |
this.firstName = attributes.firstName; | |
this.lastName = attributes.lastName; | |
this.age = attributes.age; | |
this.address = attributes.address; | |
} | |
var bob = Person({ | |
firstName: "Bob", | |
lastName: "Ject", | |
age: 33, | |
address: { | |
street: "123 Memory Ln", | |
apt: "0x7fff9575c05f", | |
zip: "01101", | |
city: "Browser Town", | |
state: "Mozilla" | |
} | |
); | |
console.log(bob); // undefined | |
console.log(window.firstName); // "Bob" | |
console.log(window.lastName); // "Ject" | |
console.log(window.age); // 33 | |
console.log(window.address); // [object Object] (address object) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment