// 返回的是true和false
// every只要有不符合条件的直接返回false(必须全部都满足条件)
var personArr = [
{name: '王港', des: '颈椎不好', sex: 'm'},
{name: '刘莹', des: '我是谁', sex: 'f'},
{name: '王秀莹', des: '我很好看', sex: 'f'},
{name: '刘金雷', des: '你没见过陌生的脸', sex: 'm'},
{name: '刘飞翔', des: '瓜皮刘', sex: 'm'},
];
Array.prototype.myEvery = function (func) {
var len = this.length;
for(var i = 0; i < len; i++) {
if(func(this[i], i, this) == false) {
return false;
}
}
return true;
}
var result = personArr.myEvery(function(ele, index, self) {
return ele.sex == 'm';
})
console.log(result);
console