JS方法使用匿名函数作为参数

2022-08-21 14:46:29
var Util={
    alert:function(msg, anonymous){alert(msg);if(anonymous){setTimeout(function(){anonymous();// 执行匿名方法},500);}},};

调用alert方法

Util.alert('hello',function(){
	location.href="csdn.net";})
  • 作者:lensko
  • 原文链接:https://blog.csdn.net/lensko/article/details/100974427
    更新时间:2022-08-21 14:46:29