Node.js Node.js v6 New Features and Improvement Arrow Functions


Example

Arrow function is the new way of defining a function in ECMAScript 6.

// traditional way of declaring and defining function
var sum = function(a,b)
{
    return a+b;
}

// Arrow Function
let sum = (a, b)=> a+b;

//Function defination using multiple lines 
let checkIfEven = (a) => {
    if( a % 2 == 0 )
        return true;
    else
        return false;
}