Hey so I'm creating a basic chrome plugin. I have done no java script until now and have only used java before. For some reason whenever I run this function it always returns false. I have added an alert in the if check and it appears.
function alarmExists() {
    var exists = false;
    
    chrome.alarms.getAll(function(alarms) {
            for(i = 0; i < alarms.length; i++) {
                if(alarms[i].name == "MyAlarm") {
                    alert("True");// This is called
                    exists = true;
                    break;
                }
            }
    });
    return exists;
} 
    