MeWrite Docs

JavaScriptエラー

9件の記事

概要

JavaScriptのランタイムエラーと構文エラーの診断ガイドです。TypeError、SyntaxError、ReferenceError、Promise関連の問題を解決します。

どこでエラーが出た?

状況エラー主な原因
TypeErrorTypeError: Cannot read properties of undefinedundefined/nullへのプロパティアクセス
Cannot read property of undefinedネストしたオブジェクトの未定義
xxx is not a function関数でないものの呼び出し
SyntaxErrorSyntaxError: Unexpected token構文の誤り・JSON解析エラー
ReferenceErrorReferenceError: xxx is not defined未定義の変数参照
Promise / asyncUnhandled promise rejectionPromiseのエラー未捕捉
await is only valid in async functionsasync関数外でのawait使用
コールスタックMaximum call stack size exceeded無限再帰
配列操作配列から要素を削除する方法splice/filter/deleteの使い分け

切り分けフローチャート

JavaScriptエラー発生
├── TypeError?
│   ├── "Cannot read properties of undefined/null" → typeerror
│   ├── プロパティアクセスで undefined → cannot-read-property-of-undefined
│   └── "is not a function" → is-not-a-function
├── SyntaxError?
│   └── "Unexpected token" → unexpected-token
├── ReferenceError?
│   └── "is not defined" → referenceerror
├── Promise関連?
│   ├── "Unhandled promise rejection" → unhandled-promise-rejection
│   └── "await is only valid in async" → await-without-async
├── "Maximum call stack"?
│   └── → maximum-call-stack
└── 配列操作で困っている?
    └── → array-remove-element
お探しの環境がありませんか?