Is it easily possible to use str.endsWith with multiple values? I have the next code:
var profileID = profile.id;
var abtest = profileID.endsWith("7");
{return abtest}
In this case I would like to check if profileID ends with a: 1, 3, 5, 7 or 9. Only if it is true, i want abtest to return true.
I know I can do it like this:
if (profileID.endsWith("1") || profileID.endsWith("3") || profileID.endsWith("5")
|| profileID.endsWith("7") || profileID.endsWith("9"))
{return abtest}
}
But I would like to try a cleaner way if possible. Does anyone know how to?