Differences between Traditional and Arrow Functions

Feature Traditional Function Arrow Function
Usage as a Method Suitable, has its own this binding. Not suitable, lacks its own this binding.
Use of yield within its body Can use yield in a generator function. Unable to use yield within its body.
Presence of Return Statements Can be used with return statements. Should not be used if return statements exist.
Keyword Targeted (let, var, const) No specific restriction on variable keywords. No specific restriction on variable keywords.
Methods (call, apply, bind) Suited for methods, allows setting a scope. Not suitable for methods that require scope setting (call, apply, bind).
Object Creation (new keyword) Can be used as a constructor function. Cannot be used with the new keyword to create a new object.
Presence of arguments object Has arguments object available. Lacks the arguments object.
Presence of prototype property Has a prototype property. Lacks the prototype property.



ES6 Arrow Function

ES6 Arrow functions enable us to write functions with simpler and shorter syntax and make our code more readable and organised. The arrow functions are introduced in the ES6 version. Arrow functions provides us with a more precise approach to writing JavaScript Functions.

Similar Reads

Arrow Function in JavaScript

Arrow functions are anonymous functions i.e. they are functions without a name and are not bound by an identifier. Arrow functions do not return any value and can be declared without the function keyword. They are also called Lambda Functions....

“this” in arrow function:

...

Differences between Traditional and Arrow Functions:

...