compare arrays and push to an empty

PHOTO EMBED

Mon Nov 25 2024 23:46:51 GMT+0000 (Coordinated Universal Time)

Saved by @davidmchale

/**
 *
 * @param {string[]} names - an array of ids
 * @param {string[]} names - an array of ids
 * @param {string[]} names - a blank array to push into
 *
 * This function will compare array1 with array2 and if the items dont match then they are pushed to array3
 */
const compareIds = (array1, array2, array3) => {
    array1.forEach((id) => {
        if (!array2.includes(id)) {
            array3.push(id);
        }
    });
};
content_copyCOPY