const userRoles = ['user', 'admin']
const allowedRoles = ['vasya', 'admin']
function roles(...roles) {
let allowed = roles.map(role => {
return userRoles.includes(role)
})
if (allowed.includes(true)) {
//
} else {
//
}
}
roles(allowedRoles)
arr1.filter(n => arr2.includes(n)).length !== 0
// или
arr1.some(function(n) {
return this.has(n);
}, new Set(arr2))
// или
new Set([ ...arr1, ...arr2 ]).size < new Set(arr1).size + new Set(arr2).size
!!new Set(arr1).intersection(new Set(arr2)).size