title: ANDing javascript objects together
body: <p>I ran across this chunk of code (modified) in our application, and am confused to how it works:</p>
  
  <pre><code>    function someObject()
      {
          this.someProperty = {};
          this.foo = 
          {
              bar:
              {
                  baz: function() { return "Huh?" }
              }
          };
  
          this.getValue = function()
          {
              return (this.someProperty &amp;&amp; this.foo.bar &amp;&amp; this.foo.bar.baz &amp;&amp; this.foo.bar.baz()) || null;
          }
      }
  
      function test()
      {
          var o = new someObject();
          var val = o.getValue();
          alert(val);
      }
  </code></pre>
  
  <p>when you call the test() function, the text "Huh?" is alerted. I'm not sure how the result of getValue is returning that, I would've thought doing A &amp;&amp; B &amp;&amp; C &amp;&amp; D would have returned true, rather than the value of D.</p>