I have a function called wikiCount that I'm using to wrap another function from an API like this:
var wikiCount = function(wikiPage, word){
wtf_wikipedia.from_api("Toronto", "en", function(markup){
var obj = wtf_wikipedia.plaintext(markup)
var a = obj.toLowerCase().split(" ").count(word)
return a
})
}
How can I return a value from the nested API function so that I can use it in the wrapper function. The whole purpose of doing this is because I'm trying to access the variable "a" outside the function.