let firstMatchValue = -1
let array1 = [1, 2, 3]
let array2 = [2, 3, 4]
firstLoop: for (let i in array1) {
for (let n in array2) {
if (array1[i] === array2[n]) {
firstMatchValue = array1[i]
break firstLoop
}
}
}
//firstMatchValue is 2
console.log(firstMatchValue)