Hacker News new | ask | show | jobs
by padolsey 2523 days ago
Quite useful in situations such as:

> (str.match(regexWithGroup) || [, null])[1]

I.e. if the regex matches, then give me the first group (1st index) otherwise give me null.