Created
May 14, 2014 21:01
-
-
Save carlosrojaso/82acbeacf447c14b3b6a to your computer and use it in GitHub Desktop.
JS Object
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
// Creating an object with the constructor: | |
var person1 = new Object; | |
person1.firstName = "John"; | |
person1.lastName = "Doe"; | |
alert( person1.firstName + " " + person1.lastName ); | |
// Creating an object with the object literal syntax: | |
var person2 = { | |
firstName: "Jane", | |
lastName: "Doe" | |
}; | |
alert( person2.firstName + " " + person2.lastName ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment