Skip to content

Latest commit

 

History

History

arrow-functions

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

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}`;