// AS-IS
function old1(a, b) {
return a+b;
}
// TO-BE
const new1 = (a, b) => { // function 선언 대신 => 기호로 함수 선언
return a+b;
}
const new2 = (a, b) => a+b; // 함수 내부에 return 문밖에 없는 경우 return 생략 가능
const new3 = (a, b) => (a+b);
// AS-IS
function old4(a) {
return !a;
}
// TO-BE
const new4 = a => !a; // 매개변수가 하나만 있으면 매개변수 소괄호 생략 가능
Ly8gQVMtSVMKZnVuY3Rpb24gb2xkMShhLCBiKSB7CglyZXR1cm4gYStiOwp9CgovLyBUTy1CRQpjb25zdCBuZXcxID0gKGEsIGIpID0+IHsJCS8vIGZ1bmN0aW9uIOyEoOyWuCDrjIDsi6AgPT4g6riw7Zi466GcIO2VqOyImCDshKDslrgKCXJldHVybiBhK2I7Cn0KCmNvbnN0IG5ldzIgPSAoYSwgYikgPT4gYStiOwkJLy8g7ZWo7IiYIOuCtOu2gOyXkCByZXR1cm4g66y467CW7JeQIOyXhuuKlCDqsr3smrAgcmV0dXJuIOyDneuetSDqsIDriqUKY29uc3QgbmV3MyA9IChhLCBiKSA9PiAoYStiKTsKCgovLyBBUy1JUwpmdW5jdGlvbiBvbGQ0KGEpIHsKCXJldHVybiAhYTsKfQoKLy8gVE8tQkUKY29uc3QgbmV3NCA9IGEgPT4gIWE7CQkvLyDrp6TqsJzrs4DsiJjqsIAg7ZWY64KY66eMIOyeiOycvOuptCDrp6TqsJzrs4DsiJgg7IaM6rSE7Zi4IOyDneuetSDqsIDriqU=