Variable ntabs in the end is empty, how i can change this code (maybe using Q, or async libs) to make it working correctly
var actions = [..];//array of objects
var ntabs = [];//arr where i put results
  actions.forEach(function(a) {
    chrome.tabs.query({url: a.url}, function(tabs) {
        tabs.forEach(function(tab) {
          var t = {
            id: tab.id,
            title: tab.title,
            url: tab.url,
            faviconUrl: tab.favIconUrl,
            actions: a.actions
          }
          ntabs.push(t);
        });
    });
  });
  console.log(ntabs);//result is empty
