标签:for == func value llb i++ asi def UNC
function reduce(arr, callBack ,initVal){ if(!Array.isArray(arr) || !arr.length || typeof callBack != ‘function‘) return []; let hasInitVal = initVal !== ‘undefined‘; let val = hasInitVal ? initVal : arr[0]; for(let i = 0, len = arr.length; i<len; i++){ val = callBack(value, arr[i], i, arr); } return val }
标签:for == func value llb i++ asi def UNC
原文地址:https://www.cnblogs.com/zmyxixihaha/p/13278526.html