javascript-tutorial / javascript-tutorial/en.javascript.info

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

オープン
#3,606 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
HTML
スター
25.5k
フォーク
4k
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

「Rethrowing」の下にある2番目のコードスニペットの位置で、Error Handlingの章を開き、示されている例をブラウザーとNode.jsで実行します。観測された出力をissueのスクリーンショットと比較し、その後、両方の環境でドキュメントに記載された動作が一致するように、スニペットまたはその説明を修正します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
50/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。