Guest User

Untitled

a guest
Jan 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. const array1 = [0, 1, 2, 3, 4];
  2. const array2 = [0, 6, 2, 3, 4];
  3.  
  4. array1.concat(array2)
  5. .forEach(item => {
  6. if (array1.includes(item) && !array2.includes(item)) {
  7. console.log(`array1に含まれていて、array2に含まれていない : ${item}`);
  8. } else if (!array1.includes(item) && array2.includes(item)) {
  9. console.log(`array1に含まれていなくて、array2に含まれていてる : ${item}`);
  10. }
  11. })
Add Comment
Please, Sign In to add comment