Code Fix

初級 › TypeError: x is not a function の原因と直し方 › パターン4

TypeError: x is not a function の原因と直し方

関数ではない値を関数として呼び出そうとしたときに出るエラーです。

 1  const numbers = [3, 1, 2];
 2  numbers._______();
               ^
 3  console.log(numbers);
main.js:2 numbers.short(); ^ TypeError: numbers.short is not a function

空欄を埋めて実行を通す

広告
広告スロット(未設定)

TypeError: x is not a function の原因と直し方

変数名やメソッド名のタイプミス、あるいはプロパティと勘違いした呼び出しで頻発します。

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)