Javascript arrow functions

stali1234

stalin s

Posted on October 6, 2022

Javascript arrow functions

Arrow functions are preety cool 😎 . They help you make code shorter, which gives less room for errors to hide. They also help you write code that's easier to understand once you get used to the syntax.

The Syntax.

Arrow function is denoted by (=>) . In ES6 its a new way to make anonymous function.

_ Normal function : _

const normalFunction = function (arg1, arg2) {
  // pls do something
}

Enter fullscreen mode Exit fullscreen mode

Arrow function

// Arrow Function

const arrowFunction = (arg1, arg2) => {
  // pls do something
}
Enter fullscreen mode Exit fullscreen mode

Steps to convert normal function to arrow function.

1) Remove function keyword from a normal function .
2) Add => after the parenthesis to get an arrow function.

Happy Learning

💖 💪 🙅 🚩
stali1234
stalin s

Posted on October 6, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related