my javascript:
function getCurrentTabId(){
chrome.tabs.query({active:true,windowType:"normal", currentWindow: true},function(d){
alert( d[0].id ); // returns expected result '2'
return d[0].id;
});
}
alert( getCurrentTabId() ); // returns 'undefined'
How do I get the last line "alert( getCurrentTabId() )" to display 2 instead of undefined?