topical media & game development

talk show tell print

professional-ajax-07-General-JSON-Examples-MixingLiteralsExample.htm / htm



  <html>
      <head>
          <title>Mixing Literals Example</title>
      </head>
      <body>
          <script type="text/javascript">
              var aCars = [
                  {
                      "color" : "red",
                      "doors" : 2,
                      "paidFor" : true
                  },
                  {
                      "color" : "blue",
                      "doors" : 4,
                      "paidFor" : true
                  },
                  {
                      "color" : "white",
                      "doors" : 2,
                      "paidFor" : false
                  }
              ];
  
              alert(aCars[1].doors);   //outputs "4"
          
          </script>    
      </body>
  </html>


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.