zoukankan      html  css  js  c++  java
  • javascript 关键字不能作为变量来使用

     var cfg={export: "export.aspx"}

    这句代码中使用了一个关键字“export” 所以在IE8中报错。

    那么有哪些关键字不能作为变量呢?

    关键字”就是 JS 本身已经使用了,具有一定特殊的含义,你就不能再用它们充当变量名啊方法名啊什么的。
    包括(按字母排序):

    breakcasecatchcontinuedefaultdeletedoelsefinallyforfunctionifininstanceofnewreturnswitchthisthrowtrytypeofvarvoidwhilewith 

    等。
    “保留字”实际上就是预留的“关键字”,意思是现在虽然现在还不是关键字(也就是本身还不具备特殊含义的),
    但是未来可能会成为关键字的,你一样是不能使用它们当变量名啊方法名的。包括(按字母排序):

    abstract、booleanbytechar、class、
    const、debuggerdouble、enum、export、
    extends、fimal、float、goto、implements、
    import、int、interface、long、mative、
    package、private、protected、public、
    short、static、super、synchronized、
    throws、transient、volatile 

    等。

    技术交流QQ群:15129679

  • 相关阅读:
    mybatis
    spring mvc
    Spring Boot2
    Spring AOP
    Spring Boot1
    Spring IOC
    Multiple_LinearRegression_Test2
    Multiple_LinearRegression_Test
    Simple_LinearRegression_Test
    写决策树时遇到的坑
  • 原文地址:https://www.cnblogs.com/yeminglong/p/6610060.html
Copyright © 2011-2022 走看看