JavaScriptのエラーメモ 随時更新

エラーを出すことは悪いことじゃないよ!
でもエラーの内容がわからないとちょっと苦戦するので、
個人的によく見るやつをメモ

未定義

定義していない変数を使おうとするとエラー。

c;

Uncaught ReferenceError: c is not defined(…)
参照

nullやundefinedにはプロパティがないため参照できない。

null[0];

Uncaught TypeError: Cannot read property '0' of null(…)
非関数

関数ではない値を、関数として使おうとした場合はエラー。

c = 0; c();

 Uncaught TypeError: c is not a function(…)
引数不足

引数が足らない。

setTimeout();

 Uncaught TypeError: Failed to execute 'setTimeout' on 'Window': 1
argument required, but only 0 present.(…)
シンタックスエラー

文法として成立していない。

eval(".");

Uncaught SyntaxError: Unexpected token .(…)
matchの挙動

matchは一致する場合に配列、しない場合にはnullを戻す。

"".match(/./g)[0];

Uncaught TypeError: Cannot read property '0' of null(…)

随時更新します