判断对象数组中每个人是否成年,大于17成年,否则未成年
var arr = [
{name:'jerry',sex:'man',age:14},
{name:'jack',sex:'woman',age:19},
{name:'bill',sex:'man',age:18}
]
var every = arr.every(function(obj){ //every 一假即假
return obj.age > 17
})
var some = arr.some(function(obj){ // some 一真即真
return obj.age >17
})
console.log(every,some) //false true
应用场景: 注册或登陆页判断所填内容是否为空