JavaScriptエラー
9件の記事
概要
JavaScriptのランタイムエラーと構文エラーの診断ガイドです。TypeError、SyntaxError、ReferenceError、Promise関連の問題を解決します。
どこでエラーが出た?
| 状況 | エラー | 主な原因 |
|---|---|---|
| TypeError | TypeError: Cannot read properties of undefined | undefined/nullへのプロパティアクセス |
| Cannot read property of undefined | ネストしたオブジェクトの未定義 | |
| xxx is not a function | 関数でないものの呼び出し | |
| SyntaxError | SyntaxError: Unexpected token | 構文の誤り・JSON解析エラー |
| ReferenceError | ReferenceError: xxx is not defined | 未定義の変数参照 |
| Promise / async | Unhandled promise rejection | Promiseのエラー未捕捉 |
| await is only valid in async functions | async関数外での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
TypeError?
SyntaxError / ReferenceError?
Promise / async?
お探しの環境がありませんか?
全記事一覧
- Cannot read property 'x' of undefined
- How do I remove a particular element from an array in JavaScript?
- RangeError: Maximum call stack size exceeded
- ReferenceError: variable is not defined
- SyntaxError: await is only valid in async functions
- SyntaxError: Unexpected token
- TypeError: Cannot read properties of undefined
- TypeError: x is not a function
- UnhandledPromiseRejection: Promise rejection was not handled
この記事は役に立ちましたか?