Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can do it in JS too:

    states.find(state => state === 'VALID' || state === 'IN_PROGRESS')
Or

    states.find(state => ['VALID', 'IN_PROGRESS'].includes(state))


This is a little further away IMO, as it doesn't have the `v1 or v2` construction.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: