I'm going to try and do this explanation by manipulating a very simple line of code and transition an anonymous function to a fat arrow function.
Switch (swap) function and (x):
This does not work. Just showing that you switch the word "function" with the parameter: (x)
Replace function with => (a fat arrow). You end up with this.
Use Firefox if you want to test this as the fat arrow function hasn't been implemented in Chrome yet.
[1,2,3].map(function(x) { return x + 1;});
Switch (swap) function and (x):
[1,2,3].map((x) function { return x + 1;});
This does not work. Just showing that you switch the word "function" with the parameter: (x)
Replace function with => (a fat arrow). You end up with this.
[1,2,3].map((x) => { return x + 1;});
Use Firefox if you want to test this as the fat arrow function hasn't been implemented in Chrome yet.