JavaScript is essentially in , and it can be used for your case for sure. Build a dictionary with any values ββyou like, but using your allowed letters as keys:
allowed = { 's':true, 'b':true, 'g':true, 'p':true, 'z':true };
Now you can directly use the in test (and more efficiently than searching the list). Here's the JavaScript copied from my console:
's' in allowed true 'q' in allowed false
source share