You are here: Foswiki>ReactJs Web>ExploringECMAScript6(ES-6)>ArrowFunctions (26 Jan 2022, shss\dhakchina)Edit Attach
-- Main.shssdhakchina - 26 Jan 2022

Arrow Functions

Arrow functions were introduced in ES6.

Arrow functions allow us to write shorter function syntax:

A Simple Arrow Function

Before
hello = function(){
 return "Hello World";
}

console.log(hello());

Using Arrow Function
let hello = () => {return "Hello World";}

console.log(hello());

Or Simply
let hello = () => "Hello World";

console.log(hello());

Arrow Function with Parameters

let mult = (a, b) => a * b;

console.log(mult(5, 10));

Topic revision: r1 - 26 Jan 2022, shss\dhakchina
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback