JavaScript menemukan elemen pencocokan dalam dua array
const intersection = array1.filter(element => array2.includes(element));
Lonely Loris
const intersection = array1.filter(element => array2.includes(element));
let firstArray = ["One", "Two", "Three", "Four", "Five"];
let secondArray = ["Three", "Four"];
let map = {};
firstArray.forEach(i => map[i] = false);
secondArray.forEach(i => map[i] === false && (map[i] = true));
let jsonArray = Object.keys(map).map(k => ({ name: k, matched: map[k] }));