<script type="text/javascript">
//正常版
// (function(){
// alert('好')//返回加
// })()
(function(){
alert('好好')
}());
//正常版不能同时出现(如果一起出现了下面也无法执行了,二者出现一个就可正常运行)
//特殊版
+ function(){
alert('好好学')
}()
!function(){
alert('好好学习')
}()
- function(){
alert('好好学习,')
}()
~ function(){
alert('好好学习,天')
}()
//技法版
var test=function(){
alert('好好学习,天天')
}()//加了括号就可以调用了
void function(){
alert('好好学习,天天向')
}
//特特殊版
new function(){
alert('好好学习,天天向上')
}()
[function(){
alert('好好学习,天天向上了')
}()]
typeof function(){
alert('好好学习,天天向上了,没')
}()
true&&function(){
alert('好好学习,天天向上了,没字')
}()
false||function(){
alert('好好学习,天天向上了,没字可')
}()
1&&function(){
alert('好好学习,天天向上了,没字可写')
}()
'a'&&function(){
alert('好好学习,天天向上了,没字可写了。')
}()
true,new function(){
alert('好好学习,天天向上了,没字可写了。完')
}()
//异象天开
; (function(){
alert('好好学习,天天向上了,没字可写了。完了。')
})()
</script>
JS中匿名函数的调用
最新推荐文章于 2022-03-01 22:08:26 发布