码迷,mamicode.com
首页 > Web开发 > 详细

js为什么报错(intermediate value)(...) is not a function

时间:2017-10-14 22:33:22      阅读:392      评论:0      收藏:0      [点我收藏+]

标签:targe   not   集成   http   href   inter   一个   tar   nbsp   

1.出错的代码     (function(){})()

原因:未添加分号

 

2.修改:在  (function(){}) 的前后都添加分号

如下:

          ;(function(){})();

也可以在上一个语句结尾处添加分号,(function(){})()前不添加

 

3.添加分号的原因

(1)防止多文件集成成一个文件后,高压缩出现语法错误。

(2)匿名函数,保护内部变量 (function(){})()

(3)提高程序性能 

 

js为什么报错(intermediate value)(...) is not a function

标签:targe   not   集成   http   href   inter   一个   tar   nbsp   

原文地址:http://www.cnblogs.com/Rcyan/p/7668684.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!