I have the following block of code
function findLastEpisodeLink_helper(title) {
var url;
chrome.history.search(
{
'text': title,
'maxResults': 1,
'startTime': 0
},
function(historyItems) {
url = historyItems[0]["url"];
// console.log(url);
}
);
// console.log(url);
return url;
}
Whenever i use this function it returns undefined, I found that its because this is a asyncronous call.
Can someone help me fix this code similar solution dont seems to work.