zoukankan      html  css  js  c++  java
  • js中export的问题

    在JS中 定义一个函数名字是export 会报错(ff不报错,ie会),修改成其他名字就行了。

    原因是,export是ECMA为将来保留的词(Words reserved for ECMA extensions)。

    下面把OReilly.JavaScript.The.Definitive.Guide.5th.Edition

    2.8. Reserved Words的内容:

    JavaScript has a number of reserved keywords. These are words that you cannot use as identifiers (variable names, function names, and loop labels) in your JavaScript programs. Table 2-1 lists the keywords standardized by ECMAScript v3. These words have special meaning to JavaScript; they are part of the language syntax itself.

    Table 2-1. Reserved JavaScript keywords

    break

    do

    if

    switch

    typeof

    case

    else

    in

    this

    var

    catch

    false

    instanceof

    tHRow

    void

    continue

    finally

    new

    true

    while

    default

    for

    null

    try

    with

    delete

    function

    return

     

     


    Table 2-2 lists other reserved keywords. These words are not currently used in JavaScript, but they are reserved by ECMAScript v3 as possible future extensions to the language.

    Table 2-2. Words reserved for ECMA extensions

    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

    debugger

     

     

     

     


    In addition to some of the formally reserved words just listed, current drafts of the ECMAScript v4 standard are contemplating the use of the keywords as, is, namespace, and use. Current JavaScript interpreters will not prevent you from using these four words as identifiers, but you should avoid them anyway.

    You should also avoid using as identifiers the names of global variables and functions that are predefined by JavaScript. If you create variables or functions with these names, either you will get an error (if the property is read-only) or you will redefine the existing variable or functionsomething you should not do unless you know exactly what you're doing. Table 2-3 lists global variables and functions defined by the ECMAScript v3 standard. Specific implementations may define other global properties, and each specific JavaScript embedding (client-side, server-side, etc.) will have its own extensive list of global properties.[*]

    [*] See the Window object in Part IV for a list of the additional global variables and functions defined by client-side JavaScript.

    Table 2-3. Other identifiers to avoid

    arguments

    encodeURI

    Infinity

    Object

    String

    Array

    Error

    isFinite

    parseFloat

    SyntaxError

    Boolean

    escape

    isNaN

    parseInt

    TypeError

    Date

    eval

    Math

    RangeError

    undefined

    decodeURI

    EvalError

    NaN

    ReferenceError

    unescape

    decodeURIComponent

    Function

    Number

    RegExp

    URIError


  • 相关阅读:
    还是解决不了滚动条的缩放问题
    全屏问题的解决
    eclipse自带内存监视及回收插件Hidden Heap Status
    Apache2.2“the requested operation has failed”解决方法
    开源软件推介(三)
    Warning: mysql_connect() [function.mysqlconnect]: [2002] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试 (trying to connect via tcp://localhost:3306)
    pdf阅读器新需求
    学Linq to sql(十):分层构架的例子(四)
    告别ASP.NET操作EXCEL的烦恼(总结篇)——放到首页奢侈下
    Linq to sql(十):分层构架的例子(二)
  • 原文地址:https://www.cnblogs.com/ainiaa/p/1995778.html
Copyright © 2011-2022 走看看