Skip to content

Conversation

@Manvendra0023
Copy link

This PR adds a small clarification to the Arrow Functions section describing cases where traditional functions are still preferred, such as function hoisting, dynamic this binding, and use of the arguments object.

The goal is to improve clarity without changing the existing recommendation.

Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arrow functions should only be used for inline callbacks. Everything else should use normal functions.

@Manvendra0023
Copy link
Author

Thanks for the clarification — that makes sense.

I agree that this guide should not encourage relying on hoisting, and that arrow functions should generally be preferred except for inline callbacks.

My intent here wasn’t to recommend hoisting as a practice, but to document why traditional functions still exist and what technical differences remain, for readers who may encounter them in real codebases.

I’m happy to remove or reword the hoisting mention to avoid implying it’s an acceptable pattern under this guide. Please let me know if you’d prefer the section to focus only on cases like named functions for debugging / stack traces, or if you’d rather drop the section entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants