Re:“Coding is basically just ifs and for loops.”
by gavinray on Saturday December 04, 2021 @07:20PM
(#29445594)
JS has Array.some() for "contains"
[ Parent
| on HN ]
Re:“Coding is basically just ifs and for loops.”
by filoeleven on Saturday December 04, 2021 @08:55PM
(#29446093)
The 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.