checkIsTrue(la, lb) {
return la.reduce((isTrue, cItem) => {
if (lb.includes(cItem.date) && cItem.state == 0) {
isTrue = true;
} else {
isTrue = false;
}
return isTrue;
}, false);
}
需求: la中元素能在lb中找到,且滿足state值是0, 如果都能找到滿足條件state=0就返回一個布爾值true抵卫,一旦有一個不在就返回false
const la = ['2020-04-23', '2020-04-24']
const lb = [
{
date: '2024-04-23',
state: 0
},
{
date: '2022-04-24',
state: 0
}
}