Skip to content

Add example showing that uninitialized var doesn't override a same-name function#44537

Open
Anusha-Pwr wants to merge 1 commit into
mdn:mainfrom
Anusha-Pwr:add-var-function-redeclaration-example
Open

Add example showing that uninitialized var doesn't override a same-name function#44537
Anusha-Pwr wants to merge 1 commit into
mdn:mainfrom
Anusha-Pwr:add-var-function-redeclaration-example

Conversation

@Anusha-Pwr

Copy link
Copy Markdown
Contributor

Description

Adds a clarifying example to the var redeclarations section showing that a var declaration without an initializer does not overwrite the value of a same-name function declaration.

Motivation

The page already explains that duplicate var declarations without initializers do not overwrite an existing value, and that a var initializer overrides a same-name function declaration. This example directly shows the related case of a var declaration without an initializer alongside a same-name function declaration, making that behavior clearer for readers.

Additional details

None

Related issues and pull requests

None

@Anusha-Pwr Anusha-Pwr requested a review from a team as a code owner June 21, 2026 18:59
@Anusha-Pwr Anusha-Pwr requested review from sideshowbarker and removed request for a team June 21, 2026 18:59
@github-actions github-actions Bot added Content:JS JavaScript docs size/s [PR only] 6-50 LoC changed labels Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Preview URLs (1 page)

Flaws (1)

Found an unexpected or unresolvable flaw? Please report it here.

URL: /en-US/docs/Web/JavaScript/Reference/Statements/var
Title: var
Flaw count: 1

  • macros:
    • Macro jsxref produces link /en-US/docs/Web/JavaScript/Reference/delete which is a redirect

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

Labels

Content:JS JavaScript docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants