JS - 函数 - 匿名函数

作用:

//一、用于绑定事件上
document.onclick = function () {
    alert("点我");
}
//定时器 
setInterval(function () {
    console.log(1000);
}, 2000);
//自调用函数
(function () {
    alert("hello");
})();



猜你喜欢

转载自blog.csdn.net/weixin_37580235/article/details/80742034
今日推荐