Skip to content

Latest commit

 

History

History
23 lines (19 loc) · 604 Bytes

File metadata and controls

23 lines (19 loc) · 604 Bytes

JavaScript - Arrow functions

Arrow functions are used to define shorter functions as per the syntax.

  • Syntax of Arrow function

    const nameOfFunction = (parameters) => {
        //statements
    };
    nameOfFunction(arguments)
  • We can remove the parenthesis () if we have only one parameter.

    const greet = avenger => {
        return `Hello, ${avenger}`
    };
  • We can remove the flower brackets {} if we have single statement which is returning something.

    const greet = avenger => `Hello, ${avenger}`;