I am unable to figure out why this event handler will not return:
function getJSON () {
    var request = new XMLHttpRequest();
    request.open('GET', 'http://quotes.rest/qod.json', true); 
    request.onreadystatechange = function () {
        if (request.status === 200 && request.readyState === XMLHttpRequest.DONE) {
        return 1;
        }
    }   
    request.send(null);
};
If I replace the return statement with a console.log(), it fires, so I know that the conditions of the if statement are met.
UPDATE:
XMLHttpRequest.onreadystatechange
I am making a call to API and expect the return statement in the eventhandler to fire once the server returns status 200 and the status of readyState equals 4 (DONE) Update 2: It is not a duplicate because l am not asking how to return call back response, but simply why the return statement fails to run
 
    