javascript自执行函数常见写法
- 代码:
var obj = (function(a,b){ a.prop = b return a }(this,'hello'))
- 测试:
console.log(obj.prop)
- 输出:
hello [Finished in 0.4s]
当前文章:javascript自执行函数常见写法
链接分享:http://ybzwz.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]