Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Wrong code in error handling chapter "Error handling, try catch"

未關閉
#3,606 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
50/100
Issue 類型
文件
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
javascript
領域
documentation

研究方向

開啟 Error Handling 章節中「Rethrowing」下的第二個程式碼片段,並在瀏覽器和 Node.js 中執行所示範例。將觀察到的輸出與 issue 的螢幕截圖進行比較,然後修正該片段或其說明,使文件記載的行為與兩個環境中的行為一致。

由索引模型根據 Issue 內容生成。

描述

There is a wrong code in the Error Handling chapter. Refer to the image and code below:

try {
  user = { /*...*/ };
} catch (err) {
  if (err instanceof ReferenceError) {
    alert('ReferenceError'); // "ReferenceError" for accessing an undefined variable
  }
}

This should output as follows in a browser environment.
image

and, nothing should be there in the terminal in Node js env. as nothing is being returned or logged.
But, as per the website when you ran the code, it shows this:

image

For reference it's the second code snippet under: https://javascript.info/try-catch#rethrowing

It might be using "use strict" internally, but its quite misleading.

主要語言
HTML
星號
25.5k
分支
4k
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

javascript-tutorial/en.javascript.info 的其他 Issue

查看 javascript-tutorial/en.javascript.info 的全部 Issue

相似的 Issue

更多 Documentation Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。