`
沙漠绿树
  • 浏览: 425535 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

解决JS中missing ( before function parameters的错误

阅读更多
引用

在编写javascript中,常出现在function处提示“missing ( before function parameters”的错误,这是怎么回事?

例如:

function String.prototype.trim(){
    return this.replace(/(^\s*)|(\s*$)/g,"");
}

就经常会报类似的错误。

改成如下时错误消失:
String.prototype.trim=function(){
    return this.replace(/(^\s*)|(\s*$)/g,"");
}

原因是:与javascript对类的方法定义的方式有关!
分享到:
评论

相关推荐

    javascript 类方法定义还是有点区别

    function abc(){} abc=function(){} 这两个定义都可以,不过后者对FF貌似好一些,前者在FF下可能出现missing before formal parameters错误,导致js无法执行。

    C++出错提示英汉对照表

    Declaration syntax error -----------------说明中出现语法错误 Default outside of switch ------------------ Default 出现在switch语句之外 Define directive needs an identifier ------------------定义编译...

    数位板压力测试

    Is anything missing? • Are future extensions possible and fairly easy? • Are vendor-specific extensions possible? 3 DESIGN CONCEPTS The proposed interface design depends on several fundamental ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    When ordering function parameters, put all input-only parameters before any output parameters. In particular, do not add new parameters to the end of the function just because they are new; place new...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX: The PointOnLine() function calulations have "single" type numbers overflow problem (changed to "double"). - FIX: The pfJoin and pfClose flags incorrectly calculates in GetEditPathCaps(). ...

    2009 达内Unix学习笔记

    输出重定向,意思就是说,将原来屏幕输出变为文件输出,即将内容输到文件中。 输入重定向。 本来命令是通过键盘得到输入的,但是用小于号,就能够使命令从文件中得到输入。 \ 表示未写完,回车换行再继续。 * ...

    CE中文版-启点CE过NP中文.exe

    There is apparently some malware going around that blocks execution of Cheat Engine (Saying file missing, check filename, etc...) If you have been a victim of this then try this windows repair tool to...

    php.ini-development

    You can redirect all of the output of your scripts to a function. For ; example, if you set output_handler to "mb_output_handler", character ; encoding will be transparently converted to the ...

    8-07-14_MegaCLI for linux_windows

    LSIP200232870 (DFCT) Add a Gen2 to Gen3 toggle function and a check for the PCI speed to MegaSCU/CLI [ PR : LSIP200231423 ] LSIP200232927 (DFCT) Port PR 198414 to MR5.4 (Headless Boot) ...

    EurekaLog_7.5.0.0_Enterprise

    4)....Fixed: Wrong passing of Boolean parameters in JSON (affects JIRA) 5)....Fixed: Wrong sorting of BugID, Count and DateTime columns in Viewer 6)....Fixed: Empty "Count" field/column is now ...

Global site tag (gtag.js) - Google Analytics