What are arrow functions in JavaScript?

An arrow function expression (previously, and now incorrectly known as fat arrow function) has a shorter syntax compared to function expressions. Arrow functions are always anonymous.

Arrow Function

  • Do not call before definition
  • An arrow function cannot contain a line break between its parameters and its arrow.

Arrow Function With Parameter

•With one Parameter
Syntax: (para) => {statement};
Syntax: para => {statement};
•More than one Parameter
Syntax: (para1, para2, paraN) => {statement};
•No Parameter
Syntax: ( ) => {statement};

Arrow Function with Parameter

•Default Parameter
Syntax: (para1, para2 = value) => {statement};
•Rest Parameter
Syntax: (para1, …args) => {statement};

Tagged : / / /
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x