SOURCE

const obj1 = [{ key: 'a', value: 1 }, { key: 'b', value: 2 }, { key: 'c', value: 3 }];
const obj2 = [{ key: 'a', value: 1 }, { key: 'b', value: 222 }, { key: 'c', value: 33 }];
function transKV(target) {
    const newArr = {};
    target.forEach(item => {
        newArr[item.key] = item.value;
    })
    return newArr
}

function ArrayObjectCompare(current, before) {
    const compareArr = [];
    //前后数组不同长度
    // const newCur = transKV(current);
    // const newBef = transKV(before);
    // Object.keys(newBef).forEach(e => {
    //     if(newBef[e] !== newCur[e]) {
    //         compareArr.push({
    //             key: e,
    //             value: newCur[e]
    //         })
    //     }
    // })
    //前后数组相同长度
    before.forEach((item, index) => {
        if (item.value !== current[index].value) {
            compareArr.push(current[index]);
        }
    })
    console.log(compareArr);
    return compareArr;
}

ArrayObjectCompare(obj2, obj1);
console 命令行工具 X clear

                    
>
console