常用js/jquery数组对象操作

var rows=[]

1,对象数组顺序反转

$.map(rows, function (v, i) {
            return rows[rows.length - 1 - i];
});

2,

var hashMap = {
Set : function(key,value){this[key] = value},
Get : function(key){return this[key]},
Contains : function(key){return this.Get(key) == null?false:true},
Remove : function(key){delete this[key]}
}

3,查找对象数组是否包含某个对象,不存在返回 undefined

rows.find(function (old) {
        if (old.FId === item.FId) return true;
});

你可能感兴趣的:(Web开发)