javascript自执行函数常见写法
- 代码:
var obj = (function(a,b){ a.prop = b return a }(this,'hello'))
- 测试:
console.log(obj.prop)
- 输出:
hello [Finished in 0.4s]
文章标题:javascript自执行函数常见写法
地址分享:http://pwwzsj.com/article/jdsdod.html
var obj = (function(a,b){
a.prop = b
return a
}(this,'hello'))
console.log(obj.prop)
hello
[Finished in 0.4s]