yes, it's because this is set based on how the function is called.
this
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)
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
yes, it's because
this
is set based on how the function is called.You can always just do: