日期:2014-05-16  浏览次数:20390 次

Javascript学习进阶——JS之美 [转]
var a=[-1,-2,-3,5,6,-1];
function f(s,e)
{
    var ret=[];
    for(var i in s)
    {
        ret.push(e(s[i]));
    }
    return ret;
}
var b=f(a,function(n){return n>0?n:0});
alert(b);

//result:
//0,0,0,5,6,0