数组的一些运算操作

1、两个数组做减法

  function sub(a, b) {
            var ret = [];
            $.each(a, function (index, el1) {
                var aitems = $.grep(b, function (el2, index) {
                    return el2.C_ID == el1.C_ID;//筛选出大于5的
                });
                if (aitems.length) {
                }
                else {
                    ret.push(el1);
                }
            });
            return ret;
        }

猜你喜欢

转载自www.cnblogs.com/sexintercourse/p/10533793.html