I have a lot of condition statements stored in a table, each of which has some wildly different formats (if x > Y, if Z = true, if Z <= 12, etc). I've stored them in such a way that I could easily loop through the condition statements and execute a function to update the relevant attributes.
However, as I've found out, it won't let me store my conditional statement as a variable. Meaning, I have to explicitly declare each conditional statement, rather than declare it once and loop through all possible conditions.
Is there a way to do this I'm missing, or simply not understanding?
In the below example, I'd like to use eTable[i].condition to loop through all of the conditions stored at that location. Is this possible somehow?
function checkEvents () {
    eventConditionLength = Object.keys(eTable).length;
    for (let i = 0; i < eventConditionLength; i++) {
        if (eTable[i].condition) {
            alert(i);
        };
    };
};
eTable
var eTable = {
0: {
        sceneTitle: '', //Descriptive/organizational only
        sceneHeader: ['Event 1', 'Event 1', 'Event 1'],
        sceneImage: ['/images/1.jpg', '/images/2.jpg', '/images/3.jpg'],
        sceneText: ['Test Scene Text 1', 'Test Scene Text 1', 'Test Scene Text 1'],
        sceneControls: ['myFunction1', 'myFunction2', 'myFunction3'],
        visible: false,
        completed: false,
        condition: 'cEvent == "e0002"'
    },
1: {
        sceneTitle: '', //Descriptive/organizational only
        sceneHeader: ['Event 1', 'Event 1', 'Event 1'],
        sceneImage: ['/images/1.jpg', '/images/2.jpg', '/images/3.jpg'],
        sceneText: ['Test Scene Text 1', 'Test Scene Text 1', 'Test Scene Text 1'],
        sceneControls: ['myFunction1', 'myFunction2', 'myFunction3'],
        visible: false,
        completed: false,
        condition: 'stat1 > 15 && completed == false'
    }
};
 
     
     
     
     
    