Javascript arrow functions
stalin s
Posted on October 6, 2022
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
}
Arrow function
// Arrow Function
const arrowFunction = (arg1, arg2) => {
// pls do something
}
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
💖 💪 🙅 🚩
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
webdev Understanding HTTP, Cookies, Email Protocols, and DNS: A Guide to Key Internet Technologies
November 30, 2024