tabID = [];
chrome.tabs.query({
currentWindow: true
}, function(tabs) {
for (var i = 0; i < tabs.length; i++) {
tabID.push(tabs[i]["id"]);
}
});
console.log(tabID[0]);
I'm trying to store the tab IDs in the current window into an array and then do other things with the IDs. However, every time I try to access the array, it says that it's undefined, but I can print the whole array and see the IDs. Do I need to do localStorage or something differently or is there a way to work in native JavaScript variables?