美文网首页JavaScript权威指南
JavaScript中保留关键字细究

JavaScript中保留关键字细究

作者: Camelion | 来源:发表于2017-04-13 01:42 被阅读0次

    (未完待续……)

    在这里(JavaScript保留关键字)列出了所有的ECAMScript 5的所有关键字和保留字。JS中包含了很多全局变量、函数、对象,一般也应当避免把它们用做变量/函数名。故在此一块儿列出。


    JavaScript 保留关键字(及全局变量)

    1. abstract/static/final/super/public/private/protected/extends/enum:抽象类。

    ()enum:在JavaScript目前的版本中,没有枚举这个概念,但仍将它作为关键字保留了。

    2. arguments:JavaScript 中每个函数内都能访问一个特别变量 arguments。这个变量维护着所有传递到这个函数中的参数列表。参阅:arguments对象

    3. boolean/Boolean/true/false:boolean是布尔型数据,其值只能是true或false。Boolean是一个全局对象。参阅:JavaScript Boolean(逻辑)对象

    4. break/continue:break会中断并跳出循环,而continue跳出循环进入下一个循环。参阅:JavaScript Break 和 Continue 语句

    5. byte:字节

    6. switch/case:switch语句基本格式为:switch(n){case 1:执行代码1; case 2:执行代码2; ... ;}。参阅:Switch 语句

    7. try/catch/throw: try 语句测试代码块的错误;catch 语句处理错误;throw 语句创建自定义错误。参阅:JavaScript 错误 - Throw、Try 和 Catch

    8. int/char/double/short/long/float/void/null/typeof

    9. class:

    10. :const/

    11. if/else

    12. while/do

    13. for/in

    14. return

    15. new/var/function

    16. export/import

    17. this

    18. debugger:debugger 语句用于停止执行 JavaScript,并调用 (如果可用) 调试函数。使用 debugger 语句类似于在代码中设置断点。参阅:debugger 语句

     default delete  eval   finally  goto  implements  instanceof  interface let  native   package    synchronized

      throws transient    volatile   with   yield

    相关文章

      网友评论

        本文标题:JavaScript中保留关键字细究

        本文链接:https://www.haomeiwen.com/subject/whbvattx.html