On the Pico, the code executes quick enough that console.log('newtime ', newtime); is executed before the timeout created with setTimeout executes, so newtime doesn't get assigned before it is used.
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.
The Pico is correct :)
On the Pico, the code executes quick enough that
console.log('newtime ', newtime);
is executed before the timeout created withsetTimeout
executes, sonewtime
doesn't get assigned before it is used.If you want this to actually work, do: