<script>
var arr = [3,4,5,6];
// filter 只要达到某个条件 就会返回一个新的数组
var res = arr.filter(item=>{
return item>4;
})
console.log(res)
var students = [
{name:"李四",age:"18岁"},
{name:"李二",age:"11岁"},
{name:"李五",age:"19岁"},
{name:"王四",age:"22.4岁"}
]
// 大于11岁 返回新的数组
var newStudents = students.filter(item=>{
return parseFloat(item.age)>11;
})
console.log(newStudents)
</script>