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操作
猜你喜欢
转载自www.cnblogs.com/liangcheng11/p/9047812.html
今日推荐
周排行