嚴謹模式
可以避免某些情況下的錯誤
//打錯字 var Person; persom = {}; //印出Object{} console.log(persom);
use strict一定要在檔案或是函數的最上方
一定要宣告
"use strict" //打錯字 var Person; persom = {}; //印出Uncaught ReferenceError: persom is not defined console.log(persom);
參考資料: MDN
Last updated 4 years ago
Was this helpful?