Lọc theo điều kiện (filter) (ok)

var tasks = [
    {
        id: this.onGenerateID(),
        name: 'Khóa học lập trình RJ',
        status: true
    },
    {
        id: this.onGenerateID(),
        name: 'Khóa học lập trình PHP',
        status: true
    },
    {
        id: this.onGenerateID(),
        name: 'Khóa học lập trình JS',
        status: false
    },
];
filter = {
    name: 'PHP'
}
tasks = tasks.filter((task)=>{
    return task.name.toLowerCase().indexOf(filter.name.toLowerCase()) !== -1;
});
Kết qủa: tasks = [
    {
        id: this.onGenerateID(),
        name: 'Khóa học lập trình PHP',
        status: true
    }
]

Last updated