Arrow Functions

Advertisement

Arrow function is a new ecmascript specification feature available for us.

Arrow Functions are the annomuis functions.

Example Example

Addition with Sum() function Addition with Sum() function

Let’s see how to use arrow Functions with simple examples

Suppose we have a JavaScript function which accept two parameters and return the addition of those numbers.

function sum( a, b ) {
     return a + b;
}

Now let’s use our sum function to get the addition of 10 and 20.

let total = sum( 10, 20 );

console.log( total );
// 30

Comolete Code Comolete Code

function sum( a, b ) {
     return a + b;
}

let total = sum( 10, 20 );

console.log( total );
// 30
%d bloggers like this: