Day 12:看 Strict Mode 如何施展「還我漂亮拳」(1)
嚴謹模式下你不能做的事
1. 不能使用未宣告的變數
x = 3.14;
console.log(x); // 3.14"use strict";
x = 3.14; // ReferenceError: x is not defined
console.log(x);2. 不能刪除變數或函數
3. 函數的參數名稱不能重複
4. 不能使用八進制的數字實字 (Octal numeric literals)
5. 不能使用八進制的跳脫字元 (Octal escape characters)
6. 不能對唯讀的物件屬性作寫入 (write to a read-only property of objects)
7. 不能對 get-only 的物件屬性作寫入
References
Last updated
Was this helpful?
