very simple and concise syntax for creating functions, 종종 함수 표현식 보다 좋다
let func = (arg1, arg2, ..., argN) => expression;
concrete example:
let sum = (a, b) => a + b;
/* This arrow function is a shorter form of :
let sum = function(a, b) {
return a + b;
};
*/
alert(sum(1,2)); // 3
If we have only one argument, then parentheses around parameters can be omitted, making that even shorter.
인수가 하나라면 인수 옆 괄호들을 생략할 수 있다.
let double = n => n * 2;
alert(double(3)); // 6
If there are no arguments, parentheses will be empty (but they should be present)
만약 인수가 하나도 없다면 괄호는 빈채로 쓴다. (괄호는 꼭 있어야 함)
let sayHi = () => alert("Hello!");
sayHi();