Skip to content

Instantly share code, notes, and snippets.

@carlosrojaso
Created May 14, 2014 21:01
Show Gist options
  • Save carlosrojaso/82acbeacf447c14b3b6a to your computer and use it in GitHub Desktop.
Save carlosrojaso/82acbeacf447c14b3b6a to your computer and use it in GitHub Desktop.
JS Object
// 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