标签:let lse bre any == some push type reac
const initIds: any[] = [1,2,3];
const Ids: any[] = [2,3,4];
const delIds: any[] = [];
const addIds: any[] = [];
Ids.forEach((id: any) => {
let flag = false;
for (let initId of initIds) {
flag = id === initId;
if (flag) {
break;
}
}
if (!flag) {
addIds.push(id);
}
});
initIds.forEach((initId: any) => {
let flag = false;
for (let id of Ids) {
flag = id === initId;
if (flag) {
break;
}
}
if (!flag) {
delIds.push(initId);
}
});
javascript替代Array.prototype.some操作
标签:let lse bre any == some push type reac
原文地址:https://www.cnblogs.com/liangcheng11/p/9047812.html