Skip to content

Clarify example in Callback function#40792

Merged
Josh-Cena merged 3 commits intomdn:mainfrom
alexcastrodev:main
Aug 19, 2025
Merged

Clarify example in Callback function#40792
Josh-Cena merged 3 commits intomdn:mainfrom
alexcastrodev:main

Conversation

@alexcastrodev
Copy link
Copy Markdown
Contributor

Description

This PR improves the Callback function glossary page by clarifying the examples that illustrate synchronous vs asynchronous callbacks.

  • Updated the synchronous example to show why console.log(value) prints 2 (because value = 2 has already run).
  • Simplified explanatory text for beginners while keeping it technically accurate.

Motivation

The previous example was incomplete and sometimes confusing for readers.
I’ve received feedback that when sharing the page, the example “didn’t work” for people who had not yet read other parts of the documentation, because the context was missing.
These changes make the examples self-contained and explicit, so they work for first-time readers as well as those familiar with other MDN docs.

@alexcastrodev alexcastrodev requested a review from a team as a code owner August 19, 2025 10:11
@alexcastrodev alexcastrodev requested review from hamishwillee and removed request for a team August 19, 2025 10:11
@github-actions github-actions bot added Content:Glossary Glossary entries size/s [PR only] 6-50 LoC changed labels Aug 19, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 19, 2025

Preview URLs

(comment last updated: 2025-08-19 18:53:08)

Copy link
Copy Markdown
Member

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

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

Sure, thanks

@Josh-Cena Josh-Cena merged commit bc07969 into mdn:main Aug 19, 2025
8 checks passed
Comment thread files/en-us/glossary/callback_function/index.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:Glossary Glossary entries size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants