ES6 introduced arrow function syntax, a shorter way to write functions by using the special “fat arrow” () => notation.
Arrow functions remove the need to type out the keyword function every time you need to create a function. Instead, you first include the parameters inside the ( ) and then add an arrow => that points to the function body surrounded in { } like this:
const rectangleArea = (width, height) => {
let area = width * height;
return area;
}It’s important to be familiar with the multiple ways of writing functions because you will come across each of these when reading other JavaScript code.
'Front-end > Javacript' 카테고리의 다른 글
JavaScript 이벤트 처리 속성 정리 (0) | 2021.09.03 |
---|---|
JavaScript - Map() (0) | 2021.08.11 |
Return (0) | 2021.07.14 |
Parameters and Arguments (0) | 2021.07.12 |
Calling a Function (0) | 2021.07.11 |