Arrow Function Vs Normal Function
A detailed comparison between Arrow Functions and normal functions in JavaScript, explaining their differences and use cases.

What is an Arrow Function?
A simpler alternative for creating functions, with some characteristics that differ from regular functions.
// Syntax
const soma = (a, b) => a + b
const mult = (a, b) => {
return a * b
}This (Context)
Its context by default is the global context. See a comparison example:
const a = () => this === object
const b = function() {
return this === object
}
const object = {
a,
b
}
console.log(object.a()) //false
console.log(object.b()) //trueIn Chrome the default context is window, so:
const a = () => this === window
...
console.log(object.a()) //trueArguments
There are no Arguments, and in some cases like in Node.js it can receive global arguments.
const a = () => arguments //Uncaught ReferenceError: arguments is not defined
console.log(a(true))In a regular function we would get the output: { '0': true }
Constructor
No Constructor.
const a = () => true
console.log(new a()) //TypeError: a is not a constructorFunction Name
In Arrow functions, the name is the identifier that is receiving the function. In a regular function we can define the function name, as in the example below, where I set the name as d.
const a = () => true
const b = function () { return true }
const c = function d () { return true}
console.log(a.name) //a
console.log(b.name) //b
console.log(c.name) //dObject Return
const casaA = () => {cozinha: true}
const casaB = () => ({cozinha: true})
const casaC = function () {
return {cozinha: true}
}
console.log(casaA()) //undefined
console.log(casaB()) //{ cozinha: true }
console.log(casaC()) //{ cozinha: true }Note: casaA returns undefined because there is no return in the function. Didn't catch that? Let me rewrite casaA and casaB in regular mode:
const casaA = function () {
{cozinha: true}
}
const casaB = function () {
return {cozinha: true}
}
console.log(casaA()) //undefined
console.log(casaB()) //{ cozinha: true }Get it? That's why we use the parentheses in the first example, casaB.
See more on MDN: developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Functions/Arrow_functions
Keep reading
Create Your First App with Electron
A step-by-step guide to creating your first desktop application with Electron and JavaScript, from the history of the project to running the finished app.
Anatomy of the System Bars: Status Bar and Navigation Bar in Flutter, Jetpack Compose and SwiftUI
I have had App Store submissions rejected over status bar contrast. How the status bar, the navigation bar and the home indicator work, what edge-to-edge changed on Android, and how to configure each bar in Flutter, Jetpack Compose and SwiftUI.
Flutter Widgetbook: How to Document your Design System the Right Way!
How Widgetbook solves the documentation problem in Flutter projects with a custom design system. On Direção Fácil, it became a visual catalog, a contract with Figma, and precise context for Claude Code to generate screens using the right widgets.
This article was translated from Portuguese with the help of an LLM. The original version may contain nuances not fully captured in this translation.