I am able to determine the first part of the question which is to return true if a string contains text from an array of substrings in NodeJS using this:
var allowedRoles = [
"Area Director",
"Managing Director",
"Group Director"];
var currentRole = "USA Managing Director";
var lifeSaver = allowedRoles.some((substring) =>
currentRole.includes(substring)
);
console.log(lifeSaver);
Here my result is true. But, I want to know that where in the allowedRole array my result returned true. (Expected answer: 1);
.some()with.findIndex()