DEV Community

Discussion on: ✔||🤢 Commit or Vomit | checks.some()

Collapse
 
bugb profile image
bugb • Edited

The problem is how do you know what the piece of data that is invalid age or username or something (you need to have additional code). And what if you want to throw custom error message for each case?

Array in JS is also weird (if you dont know the spec of map or using Typescript)

a=[].map(v=>v.v.v.v.v.v) // it is valid
Enter fullscreen mode Exit fullscreen mode

It can cause debuging becomes nightmare!

So I prefer if-else.