It's a bit unclear to me how arrow functions react to semicolons, for
example:

var a = (c) => {
  var b = 2;
  b * c;
}

a(4);

To me, it seems like this should return undefined. After all, the last
statement in the function is empty. To actually return b * c, you should
drop the semicolon:

var a = (c) => {
  var b = 2;
  b * c
}

a(4);

This would be consistent with, for example, Rust and would help avoid
annoying accidental returns (see [1] for discussion about this wrt
CoffeeScript).

Cheers,
Jussi

[1] https://github.com/jashkenas/coffee-script/issues/2477
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to