← Week 4 — 19 / 24 →

ES6 New Features: Arrow Functions

Arrow functions are a more concise syntax for writing function expressions.

let sum = function(x, y) { return x + y; };
let add = (x, y) => x + y;

sum(1, 2);  // 3
add(1, 2);  // 3