Created
December 2, 2014 20:06
-
-
Save devdays/926cc7be742c9459283d to your computer and use it in GitHub Desktop.
Object JavaScript - Literals in Action
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
var empty = {}; // An object with no properties | |
var point = { x:0, y:0 }; // Two properties | |
var point2 = { x:point.x, y:point.y+1 }; // More complex values | |
var book = { | |
/* property names can include spaces and hyphen | |
and quoted reserved words. */ | |
"main title": "HTML5", | |
'sub-title': "For All Devices", | |
"for": "age 13 and up", | |
// And can include another object | |
author: { | |
firstname: "Bruce", | |
lastname: "Kyle" | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment