How to check if an array has values from another array?

Asked

Viewed 13 times

0

Well, the problem is this, I have a function in which it requires a property permissions array type, inside the function, is a const perms = ['perm_1', 'perm_2', 'perm_3'].

Let’s say the user has set the function to be MeuTeste(['perm_1', 'perm_3').

How can I check whether the values of permissions exists within const perms?

Sample code

function MeuTeste(permissions) {
  const perms = ['perm_1', 'perm_2', 'perm_3'];
}

Thanks in advance!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.