title: Unable to add a property to an object using either the dot notation or the indexer notation?
body: <p>I am trying to add a property named <code>params</code> to a property named <code>url</code> of a class named <code>Page</code>. The property <code>params</code> must be assigned the return value of an anonymous function.</p>
  
  <p>The function runs just fine.</p>
  
  <p>However, <em>after</em> assigning the return value of the function, when I check to see if the property <code>params</code> has been assigned to, I see no such property in the watches window or in the console. When I try to read back the property <code>params</code> from the <code>url</code> property, I get <code>undefined</code>.</p>
  
  <p>Why is that? This happens whether I use the dot notation or the indexer notation to write / assign a value to the property. Below is my code:</p>
  
  <pre><code>var app = 
  {
      ...
  };
  
  $(document).ready(function() {
      var page = new Page(app);
      page.display();
  });
  
  var Page = function(app) {
  
      this.url = window.location.href;
      this.app = app;
  
      this.url.params = (function() {
  
          var p = { };
  
          if (this.indexOf('?') &lt; 0) return p;
  
          var query = this.split('?')[1];
  
          var pairs = query.split('&amp;');
  
          if (pairs === undefined || pairs.length == 0) return p;
  
          for(var i = 0; i &lt; pairs.length; i++) {
              var pair = pairs[i].trim();
  
              if (pair.length == 0) continue;
  
              if (pair.indexOf('=') &lt; 0) {
                  p[pair[0]] = '';
              }
              else {
                  var prop = pair.split('=');
  
                  p[prop[0]] = prop[1];
              }
          }
  
      }.bind(this.url))();
  
      this.display = function() {
  
          debugger;
  
          // over here, when I watch 'url', it does
          // not have a 'params' property
      };
  };
  </code></pre>