Difference between ES6 Arrow functions and Regular functions in JavaScript
Arrow functions vs Regular functions
ES6 introduced a new way of writing simple and concise functions. The arrow functions expression is explained in the ES6 Arrow Functions in the JavaScript blog.
Arrow function very useful for developers, yes it helps to make the coding is faster. Arrow functions are commonly used wherever an anonymous function expression is required like callback functions.
According to MDN, the arrow function is described as below
An arrow functions expression is a syntactically compact alternative to a regular expression, although without its own bindings to the
this
,arguments
,super
, ornew.target
keywords. Arrow function expressions are ill suited as methods, and they cannot be used as constructors.
If you confessed to the above MDN statement, don’t worry the arrow function differences are listed below and explained with simple examples.
- Shorter function expression
- No own
this
Keyword bindings - No
arguments
bindings - No duplicate named parameters
- Using constructor & new keyword