//You can try this : const resultArr = array1.flatMap(x => array2 .filter(y=>y[0] === x[2]) .map(y => [...y,...x]) );