函数作为参数值传递时为自己带参

function a(func)
{
    func();
}

function b(param)
{
    alert(param);
}

var p = 9080;

a(function(){b(p)});//会 alert 9080

 使用匿名函数,外包层实现传参。

posted @ 2019-02-19 10:59  expworld  阅读(296)  评论(0)    收藏  举报