Arrow functions create a concise expression that encapsulates a small piece of functionality. Additionally, arrows retain the scope of the caller inside the function eliminating the need of self = this.
const add = function(x,y) {
return x + y;
}
Can be rewritten as:
const add = (x, y) => { return x + y };
Since the function is a single expression return and braces are not needed.
const add = (x, y) => x + y; console.log(add(5,10)) //15