function xx(_dat){ function newData() { this.data = []; this.init = function(_d) { this.data = _d; return this; }; this.where = function(_c) { return (new newData()).init(this.data.filter(function(_item) { return _item.value.match(_c) })); }; this.orderBy = function(_k,_way) { if(_way == "desc"){ return this.data.sort(function(a,b) { return b[_k] - a[_k]; }); }else{ return this.data.sort(function(a,b) { return a[_k] - b[_k]; }); } }; } return (new newData()).init(_dat); }
点赞 1

相关推荐

面了100年面试不知...:今年白菜这么多,冬天可以狂吃了
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务