title: Javascript object set to another object is undefined
body: <p>For my chrome extension, I have a function called storeGroup that returns an object. However, in function storeTabsInfo, when I call storeGroup and set it equal to another object, the parts inside the object are undefined. The object is being populated correctly in storeGroup, so I'm not sure why it's undefined?</p>
  
  <pre><code>function storeTabsInfo(promptUser, group)
  {
  var tabGroup = {};
  
  chrome.windows.getCurrent(function(currentWindow)
  {
      chrome.tabs.getAllInWindow(currentWindow.id, function(tabs)
      {
          /* gets each tab's name and url from an array of tabs and stores them into arrays*/
          var tabName = [];
          var tabUrl = [];
          var tabCount = 0;
  
          for (; tabCount &lt; tabs.length; tabCount++)
          {
              tabName[tabCount] = tabs[tabCount].title;
              tabUrl[tabCount] = tabs[tabCount].url;
          }
  
          tabGroup = storeGroup(promptUser, group, tabName, tabUrl, tabCount);   // tabGroup does not store object correctly
          console.log("tabGroup: " + tabGroup.tabName);   // UNDEFINED
          chrome.storage.local.set(tabGroup);
      })
  })
  }
  
  function storeGroup(promptUser, group, name, url, count)
  {
  var groupObject = {};
  // current count of group
  var groupCountValue = group.groupCount;
  
  var groupName = "groupName" + groupCountValue;
  groupObject[groupName] = promptUser;
  
  var tabName = "tabName" + groupCountValue;
  groupObject[tabName] = name;
  
  var tabUrl = "tabUrl" + groupCountValue;
  groupObject[tabUrl] = url;
  
  var tabCount = "tabCount" + groupCountValue;
  groupObject[tabCount] = count;
  
  var groupCount = "groupCount" + groupCountValue;
  groupObject[groupCount] = groupCountValue + 1;
  
  // successfully shows parts of groupObject
  console.log("Final group: " + groupObject[groupName] + " " + groupObject[tabName] + " " + groupObject[tabUrl] + " " + groupObject[tabCount] + " " + groupObject[groupCount]);
  return groupObject;
  }
  </code></pre>