Skip to content

Functions guide: replace flawed zoo analogy for scope - #45421

Merged
chrisdavidmills merged 3 commits into
mdn:mainfrom
BaconMan1168:issue-45401-scope-analogy
Sep 1, 2026
Merged

Functions guide: replace flawed zoo analogy for scope#45421
chrisdavidmills merged 3 commits into
mdn:mainfrom
BaconMan1168:issue-45401-scope-analogy

Conversation

@BaconMan1168

Copy link
Copy Markdown
Contributor

Description

Replaces the zoo/zookeeper analogy in the "Function scope and conflicts" section with an apartment-building analogy: private apartments represent function scope, and shared common areas (pool, gym, rec room) represent the global scope. Also removes the now-unused zoo illustration.

Motivation

The zoo analogy was backwards/misleading — it framed the "zoo keeper" (global scope) as reaching into every enclosure (function scope), when the actual point is the reverse: things declared in global scope are accessible to narrower scopes, not the other way around.

Additional details

The apartment-building analogy was proposed by @wbamberg in the issue thread and confirmed as clearer by the reporter @mao-sz. No other content on the page was changed.

Related issues and pull requests

Fixes #45401

…alogy

The zoo analogy implied the global scope reaches into function scopes, which is backwards. Use an apartment-building analogy instead, where private apartments represent function scope and shared common areas represent the global scope.
@BaconMan1168
BaconMan1168 requested a review from a team as a code owner September 1, 2026 04:22
@BaconMan1168
BaconMan1168 requested review from chrisdavidmills and removed request for a team September 1, 2026 04:22
@github-actions github-actions Bot added Content:Learn Learning area docs (outside of one of the Learn:* subtags) size/s [PR only] 6-50 LoC changed labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Preview URLs (1 page)

(comment last updated: 2026-09-01 10:41:02)

@chrisdavidmills chrisdavidmills left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM; thanks, @BaconMan1168. I've made some structural suggestions. I think having the two parts of the analogy as bullets makes sense.

Comment thread files/en-us/learn_web_development/core/scripting/functions/index.md Outdated
Comment thread files/en-us/learn_web_development/core/scripting/functions/index.md Outdated
BaconMan1168 and others added 2 commits September 1, 2026 18:39
…ex.md

Co-authored-by: Chris Mills <chrisdavidmills@gmail.com>
…ex.md

Co-authored-by: Chris Mills <chrisdavidmills@gmail.com>

@chrisdavidmills chrisdavidmills left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good. Thanks, @BaconMan1168.

@chrisdavidmills
chrisdavidmills merged commit dee770b into mdn:main Sep 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:Learn Learning area docs (outside of one of the Learn:* subtags) size/s [PR only] 6-50 LoC changed

3 participants