Arrow Function - 02

Arrow Function: 

removes the use of function keyword, includes parameters inside parentheses then add an arrow => that points to the function body surrounded by curly braces.

The arrow function will be stored in a variable.

 

Syntax : 


const rectangleArea = (width, height) => {
      let area = width * height;
      return area;
};

If a function takes zero and two or more parameters, parentheses() are required.












If a function body composed of a single line block does not need curly braces and return keyword can be removed.





Post a Comment

Previous Post Next Post