• yes, it's because this is set based on how the function is called.

    O.M(); // this==O
    
    var A = {};
    A.M = O.M;
    A.M(); // this==A
    
    var f = O.M();
    f(); // this==undefined <- what is happening with setInterval
    

    You can always just do:

    setInterval(() => O.M(), 1000)
    
About

Avatar for Gordon @Gordon started