初級 › 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
空欄を埋めて実行を通す
配列を並び替えるメソッドはsortです。shortという名前のメソッドは存在しません。
次の問題