Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const array1 = [0, 1, 2, 3, 4];
- const array2 = [0, 6, 2, 3, 4];
- array1.concat(array2)
- .forEach(item => {
- if (array1.includes(item) && !array2.includes(item)) {
- console.log(`array1に含まれていて、array2に含まれていない : ${item}`);
- } else if (!array1.includes(item) && array2.includes(item)) {
- console.log(`array1に含まれていなくて、array2に含まれていてる : ${item}`);
- }
- })
Add Comment
Please, Sign In to add comment