首页 > 代码库 > JavaScript笔记3--标识符和保留字

JavaScript笔记3--标识符和保留字

1.标识符
javaScript标识符必须以字母,下划线(_)或美元符($)开始.后续的字符可以是字母/数字/下划线/美元符.也可以使用非英语语言或数学符号来书写标识符;

2.保留字
break/delete/function/return/typeof/case/do/if/switch/var/catch/else/in/this/void/continue/false/instanceof/throw/while/debugger/finally/
new/true/with/default/for/null/try

3.ECMAScript5保留了以下关键字:
class/const/enum/export/extends/import/super

4.严格模式下的关键字:
implements/let/private/public/yield/interface/package/protected/static/arguments/eval

5.ECMAScripts3保留了以下关键字:
abstract/double/goto/native/static/boolean/enum/implements/package/super/byte/export/import/private/synchronized/char/extends/int/protected/throws/class/final/interface/public/transient/const/float/long/short/volatile

6.预定义的全局变量和函数名,应避免使用作为自己的标识符:
arguments/encodeURI/Infinity/Number/RegExp/Array/encodeURIComponent/isFinite/Object/String/Boolean/Error/isNaN/parseFloat/SyntaxError/Date/eval/JSON/parseInt/TypeError/decodeURI/EvalError/Math/RangeError/undefined/decodeURIComponent/Function/NaN/ReferenceError/URIError

JavaScript笔记3--标识符和保留字