every:一假即假,必须所有都返回true才会返回true,哪怕有一个false,就会返回false;
some:一真即真, 只要其中一个为true 就会返回true
let list = [
{name:"aaa",age:3},
{name:"bbb",age:4},
{name:"ccc",age:5},
];
var eve= list.every(function(item){
return item.age > 4
})
console.log(eve)//false;
var some = list.some(function(item){
return item.age > 4
})
console.log(some)//true
网友评论