This is a draft cheat sheet. It is a work in progress and is not finished yet.
Data Types
String |
{ "animal" : "cat" } |
|
{ "promo": "Say \"Bob's the best!\" at checkout for free 8oz bag of kibble." } |
Number |
{ "widgetInventory": 289, |
|
"sadSavingsAccount": 22.59, |
|
"seattleLatitude": 47.606209, |
|
"seattleLongitude": -122.332071, |
|
"earthsMass": 5.97219e+24 } |
Boolean |
{ "toastWithBreakfast": false, |
|
"breadWithLunch": true } |
Null |
{ "watchColor": null } |
Array |
{ "carBrand":["Ford", "BMW","Fiat"] } |
Object |
{ "name":"John","age:30,"car":null } |
Objects
var myObject = |
{ "firstName": "John", |
|
"age": 39, |
|
"registered": true, |
|
"car": null } |
Acess object properties
myObject.firstName |
returns "John" |
myObject["age"] |
returns 39 |
myObject[2] |
returns true |
|
|
|
|
|