-
arrow function ex.Study/JavaScript 2020. 5. 2. 18:53
const fruits = ['mango', 'papaya', 'pineapple', 'apple']; // Iterate over fruits below fruits.forEach(function(fruits){ console.log(`I want to eat a ${fruits}.`); }) fruits. forEach(fruits => {console.log(`I want to eat a ${fruits}.`);} //위 두 코드는 같은 코드임. 3줄짜리 익명함수와 1줄짜리 arrow함수
)
'Study > JavaScript' 카테고리의 다른 글
Getters (0) 2020.05.06 Array.prototype.every() (0) 2020.05.06 Higher order function (0) 2020.05.02 What are other uses of functions as data? (0) 2020.05.02 for문과 while문의 차이점 (0) 2020.05.01