JS

        Array.prototype.contains = function ( needle ) {
            for (let item of this) {
                if (item === needle) return true;
            }
            return false;
        };
        Array.prototype.pluck = function ( needle ) {
            let results = [];
            for (let item of this) {
                results.push(item[needle]);
            }
            return results;
        };
评论数量: 0

0
点赞
25
浏览
0
评论

贡献 16