javascript自执行函数常见写法
- 代码:
var obj = (function(a,b){ a.prop = b return a }(this,'hello'))
- 测试:
console.log(obj.prop)
- 输出:
hello [Finished in 0.4s]
分享名称:javascript自执行函数常见写法
网页地址:http://azwzsj.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]