With the same code, I have different output on pico and esp8266.
Which one is correct? I think it is esp8266, but I may be wrong.
esp8266 _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v85.1127 Copyright 2016 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 512KB:256/256, manuf 0xc8 chip 0x4013 >echo(0); oldtime 1462372910.64224791526 newtime 1462372911.01720309257 diftime 0.37495517730 =undefined > pico _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v85 Copyright 2016 G.Williams >echo(0); oldtime 1462373548.05334663391 newtime undefined Uncaught ReferenceError: "newtime" is not defined at line 1 col 25 console.log('newtime ', newtime); ^ diftime NaN Uncaught ReferenceError: "newtime" is not defined at line 1 col 33 console.log('diftime ', newtime-oldtime); ^ =undefined >
code:
oldtime = getTime(); setTimeout(function() { newtime = getTime(); },160); console.log('oldtime ', oldtime); console.log('newtime ', newtime); console.log('diftime ', newtime-oldtime);
@Frida 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.
With the same code, I have different output on pico and esp8266.
Which one is correct?
I think it is esp8266, but I may be wrong.
code: