Sorry if this is extremely simple, I can't get my head around it. I've seen similar questions but nothing which gets to the heart of my problem, I think. I have a simple async function:
async function isOpen() {
    var open;
    var data = $.ajax({
      //Working code here
    });
    data.done(function(dat) {
        var obj = JSON.parse(dat);
        var msg = "";
        for (var i = 0; i < obj.length; i++) {
            let closingDate = Date.parse(obj[i].close);
            let openingDate = Date.parse(obj[i].open);
            if (closingDate > Date.now() && openingDate < Date.now()) {
                open = true;
            } else {
                open = false;
            }
        }
    });
    return open;
}
I know that this code is all working - using console.log I have seen that open is always successfully assigned to true or false. So I call this async function from another async function:
async function testFunction(){
    const open1 = await isOpen();
    //More code here...
}
But open1 (in testFunction) is always undefined - even though I use await.
Any ideas what this could be?
 
     
     
    