How does js determine that an item in one array contains another array?

such as the question: how does js determine an item in an array that contains another array?
if

A=[1,2,3,4,5,6];
B=[8,10,6,7,8];

how can you tell that an item in array B also exists in array A (it is best to return the sequence value of the item in B)?
or how to tell if two arrays have the same item?
use es5 as much as possible

Jul.22,2021

let A=[1,2,3,4,5,6],
    B=[8,10,6,7,8];
   A.find(item=>B.includes(item)) //undefined

var a=[1,2,3,4,5,6];
var b=[8,10,6,7,8];

function getArrRepeat(arr1,arr2){
    return arr1.filter((item,index) =>{
        return arr2.includes(item)
    })
}            
console.log(getArrRepeat(a,b)) //6

at your request, do not use ES6, with ES5

var mix = [1,2,3,4,5,6].filter(function(item){
    return [8,10,6,7,8].indexOf(item) != -1
});
console.log(mix) // 

includes and indexOf can both


double for circulation

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e46cbe-66583.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e46cbe-66583.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?