zhiqingstudy

Be a young person with knowledge and content

The filter() function is a filter function that returns qualified data; Indicates that the data meets the filter conditions.

let zq=["知青","知青学习"];
let newArray=zq.filter(function(value,index,arr){
    console.log(value,index,arr);
    return true;//返回值为true时,表示要这个值
});
console.log(newArray);

Case: filtering out js courses from all courses

let lesson=[{name:"学习js第一课",category:"js"},{name:"学习js第二课",category:"js"},{name:"学习python第一课",category:"python"}];
let res=lesson.filter(function(value){
    return value.category=="js";
});
console.table(res);
comment
head sculpture
Code:
Related

Why you shouldn't stay at a job for more than 2 years?

3 harsh facts long-distance relationships

how to keep your girlfriend interested in a long-distance relationship




Unless otherwise specified, all content on this website is original. If the reprinted content infringes on your rights, please contact the administrator to delete it
Contact Email:2380712278@qq.com

Filing number:皖ICP备19012824号