Objects
Object Declaration in JavaScript
Used to declare an object, which contains key-value pairs.
Syntax
var objectName = { key: value };
objectName.key; //accessing the value associated with the key
objectName["key"]; //accessing if the key is provided as a string
Notes
Accessing a key that is not set will return undefined.
Values associated with keys can be functions, arrays, or just regular variables.
Example
var legs = { dog: '4', "cat": '4', human: '2' };
legs.dog; //will return 4
legs["cat"]; //cat is declared as a string, access it like this