You are reading a single comment by @Drarok and its replies. Click here to read the full conversation.
  • 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
    
About

Avatar for Drarok @Drarok started