PUBlished on
June 14, 2019
• updated on
November 5, 2025

Javascript Arrow Functions are Overhyped

JORGE CUADRA FUEYO

Since Javascript upgraded to ES2015, I have frequently seen many developers defaulting to arrow functions instead of normal functions.

I think arrow functions are cool, short, and they even look mathematical.

// traditional function

function(x) {
 
return x * x;
}

// arrow function
x => x * x;

🧐 🤨 (╯°□°)╯︵ ┻━┻

My critique is that people use them without asking why. I assume that it happens because it’s the cool way to write Javascript since it’s a newer feature than the regular functions.

Named Arrow functions can be more verbose

Using React jsx with functional components.

// a bit longer and more cryptic.
const Input = ({ num }) => { var dup = num * 2; return <>{dup}</> };

// a bit less characters and it can hoist
function Input({ num }) { var dup = num * 2; return <>{dup}</> }

An example with an array map

// have to declare function before calling it
const duplicate = x => { var res = x * 2; return res; };

[1,2,3].map(duplicate);

// vs

// Regular functions hoist.
// I consider this easier to read since you first see the
// named function identifier and bellow you can optionally
// look at the definition.

[1,2,3].map(duplicate);

function duplicate(x) { var res = x * 2; return res; }

Named functions are easier to read and track

Named functions are easier to read (less cryptic), easier to debug because they appear in the call stack with their name instead of “anonymous”, they also appear named in the performance audit report.

Ending note

Put some thought when you use a feature in a programming language. Not just because that’s how the 😎“cool kids” do it you should always do it like that. Tools have their optimal use-cases. If you are writing code for a team you should consider the optimal implementations.

Frequently Asked Questions (FAQs)

When should I use arrow functions over regular functions in JavaScript?

Arrow functions are best used for short, inline callbacks where you don't need your own `this`, `arguments`, or `super` context—such as with array methods like `.map()` or `.filter()`. They provide a concise syntax, but for more complex functions, or when hoisting and better debugging are important, regular functions may be preferable.

Do arrow functions support function hoisting like traditional functions?

No, arrow functions do not support hoisting. This means you must declare an arrow function before you use it in your code. Traditional function declarations, on the other hand, are hoisted, allowing you to call them earlier within the same scope.

Are arrow functions easier to debug than regular functions?

Arrow functions can be harder to debug, especially when they are used anonymously. Traditional named functions appear more clearly in stack traces and performance reports, making it easier to identify issues in large codebases.

How does using arrow functions affect code readability?

While arrow functions can make code more concise, they may sacrifice readability, especially in complex code or for developers unfamiliar with the syntax. Named traditional functions are often easier to read and understand, making them preferable for larger teams or long-term projects.

You May Also Like

Get Started

Start in minutes and secure your critical SaaS applications with continuous monitoring and data-driven insights.

get a demo