I want to change an array of strings in a callback function and also allow it to be accessible outside of the callback. At line A console prints object. At line B however, console prints undefined, and thus I cannot access the information that was stored in the callback. What is going on here and how can I fix this?
var A;
tempService.route(
function() {
A = [2];
A[0] = "Bob";
A[1] = "Joe";
console.log(typeof A); //line A
})
console.log(typeof A); //line B