Friday, March 21, 2014

What I Learned About JavaScript Arrays and Objects

I finished the Choose your own Adventure, it technically works but I will post it on my website when I make it more interesting.

Arrays
  • Arrays don't need to hold the same datatypes
  • Arrays can be nested, you can have arrays in arrays
  • Ex. myArray = [[true, false, 3, "three"], ["hello", 4], [0]]
Objects
  •  
  • you can create objects with nothing in them
    • var me = new Object();
  • you can add to objects
    • myObj["name"] = "Charlie";
      myObj.name = "Charlie";
       
  • similar to arrays they are formatted
    • var myObj = {
          type: 'fancy',
          disposition: 'sunny'
      }; 
      
      

1 comment: