I have a hidden field on my page that stores space separated list of emails. I can have maximum 500 emails in that field.
What will be the fastest way to search if a given email already exists in that list? I need to search multiple emails in a loop
use RegEx to find a match
use indexOf()
- convert the list to a javascript dictionary and then search
If this is an exact duplicate, please let me know the other question. Thanks
EDIT: Thanks everyone for your valuable comments and answers. Basically my user has a list of emails(0-500) in db. User is presented with his own contact list. User can then choose one\more emails from his contact list to add to the list. I want to ensure at client side that he is not adding duplicate emails. Whole operation is driven by ajax, so jsvascript is required.