Menu

1 / 2

Arrow Functions in JavaScript: A Simpler Way to Write Functions

DEV Community·Pratham·6 months ago
#zdxKjINQ
#arrow#with#part#function#return
Reading 0:00
15s threshold

Less typing, cleaner syntax, and the modern way to write JavaScript functions.

The first time I saw an arrow function, I thought someone had accidentally deleted half the code. No function keyword? No curly braces? No return statement? And it still works ?

const square = n => n * n ;

Enter fullscreen mode

Exit fullscreen mode

That's a complete, working function. It takes a number, squares it, and returns the result. Compare that to the traditional version:

function square ( n ) { return n * n ; }

Enter fullscreen mode

Exit fullscreen mode

Same behavior, half the characters. Arrow functions were introduced in ES6 (2015), and they've become the default way to write functions in modern JavaScript. In the ChaiCode Web Dev Cohort 2026, they show up in almost every lesson — callbacks, array methods, event handlers, React components.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.