Oh, and another weird one with arrow functions: they don't seem to be passed values if defined with parentheses:
function go() { var p1 = new Promise(function (res, rej) { setTimeout(() => res(1), 250); }); p1.then(x => { console.log('Bare arrow:', x); }); p1.then((x) => { console.log('Parentheses arrow:', x); }); p1.then(function (x) { console.log('Regular:', x); }); }
Output:
Bare arrow: 1 Parentheses arrow: undefined Regular: 1
@Drarok 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.
Oh, and another weird one with arrow functions: they don't seem to be passed values if defined with parentheses:
Output: