Using Babel, I can see that
callback = () => {};
compiles to
callback = function callback() {};
which is what I expect. However I get an error when I try to use it with ||
callback = callback || () => {}
Which I'd expect to be equivalent to
callback = callback || function(){};
Why is this an error? Also, is there a more correct ES6 version of this familiar syntax?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…