初級 › ReferenceError: x is not defined の原因と直し方 › パターン1
ReferenceError: x is not defined の原因と直し方
存在しない変数・関数名を参照したときに出るエラーです。
1 let total = 100; 2 console.log(______); ^
main.js:2
console.log(totall);
^
ReferenceError: totall is not defined
空欄を埋めて実行を通す
変数名のスペルミスです。JavaScriptは大文字小文字を区別するため、Totalとtotalも別の名前として扱われます。
次の問題