Friday, September 28, 2012

variable chaining in JavaScript!

This will bring up "Qux" in an alert!

<html>
   <body>
      <script language="javascript" type="text/javascript">
         var Foo = {
            Bar: {
               Baz: "Qux"
            }
         };
         alert(Foo.Bar.Baz);
      </script>
   </body>
</html>

No comments:

Post a Comment