Skip to content

Conversation

@kashish2710
Copy link
Contributor

Fixes #42503

  • Moved const button declaration before the updateName function so the JS example works correctly.
  • Updated HTML snippet to use <script defer src="script.js"></script> to ensure JS runs after page loads.
  • This fixes the "Cannot access 'button' before initialization" error in the example.

@kashish2710 kashish2710 requested a review from a team as a code owner December 23, 2025 11:06
@kashish2710 kashish2710 requested review from hamishwillee and removed request for a team December 23, 2025 11:06
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs Content:Learn Learning area docs size/s [PR only] 6-50 LoC changed labels Dec 23, 2025

To save a {{HTMLElement("canvas")}} element's contents as an image, you can create a link where the `href` is the canvas data as a `data:` URL created with JavaScript and the `download` attribute provides the file name for the downloaded PNG file:

> **Note:** The "Download my painting" link will not work in MDN live examples because downloads are disabled in sandboxed iframes.
Copy link
Contributor

Choose a reason for hiding this comment

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

[mdn-linter] reported by reviewdog 🐶

Suggested change
> **Note:** The "Download my painting" link will not work in MDN live examples because downloads are disabled in sandboxed iframes.
> **Note:** The "Download my painting" link will not work in MDN live examples because downloads are disabled in sandboxed iframes.


To save a {{HTMLElement("canvas")}} element's contents as an image, you can create a link where the `href` is the canvas data as a `data:` URL created with JavaScript and the `download` attribute provides the file name for the downloaded PNG file:

> **Note:** The "Download my painting" link will not work in MDN live examples because downloads are disabled in sandboxed iframes.
Copy link
Contributor

Choose a reason for hiding this comment

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

[markdownlint] reported by reviewdog 🐶
error search-replace Custom rule [gfm-alert: Use the GFM syntax: https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Howto/Markdown_in_MDN#notes_warnings_and_callouts] [Context: "column: 1 text:'> Note:'"]

@github-actions
Copy link
Contributor

github-actions bot commented Dec 23, 2025

Preview URLs

Flaws (1)

URL: /en-US/docs/Learn_web_development/Core/Scripting/What_is_JavaScript
Title: What is JavaScript?
Flaw count: 1

  • macros:
    • Macro ? produces link /en-US/curriculum/ which doesn't resolve

(comment last updated: 2025-12-23 11:15:24)

@github-actions github-actions bot added size/l [PR only] 501-1000 LoC changed and removed size/s [PR only] 6-50 LoC changed labels Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:HTML Hypertext Markup Language docs Content:Learn Learning area docs size/l [PR only] 501-1000 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code for "What is Javascript?" is incorrect.

1 participant