3 ms·
JS has Array.some() for "contains"
by gavinray 5y ago
JS has Array.some() for "contains"
- filoeleven 5y agoThe caveat there is that you cannot call it without a null check on “u.name” first. contains(null, “whatever”) would just return false instead of throwing a runtime exception. Hence my edit: users.filter() has the same problem.