5 ms·
So if I understand correctly, in Javascript a fat arrow is just the syntax sugar for: var x = function(x){ return x };
by BerislavLopac 8y ago
So if I understand correctly, in Javascript a fat arrow is just the syntax sugar for:
var x = function(x){ return x };
- wwright 8y agoThe two biggest differences iirc: - it can never be named - it inherits `this` lexically from its parent scope (which imo is the sane default)
- mlcdf 8y agoIt also changes the behavior of this. [0] [0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#No_separate_this https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...