title: Javascript merge objects
body: <p>Can someone suggest a better way of doing something like the following:</p>
  
  <pre><code>setData(start, end, country, person, type, data){
      this.cachedData[start] = this.cachedData[start] ? this.cachedData[start] : {};
      this.cachedData[start][end] = this.cachedData[start][end] ? this.cachedData[start][end] : {};
      this.cachedData[start][end][country] = this.cachedData[start][end][country] ? this.cachedData[start][end][country] : {};
      this.cachedData[start][end][country][person] = this.cachedData[start][end][country][person] ? this.cachedData[start][end][country][person] : {};
      this.cachedData[start][end][country][person][type] = data;
    }
  </code></pre>