Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 20, 2021 09:13 am GMT

|| Commit or Vomit | checks.some()

It's tuesday!

Time for a new || Commit or Vomit! This time it is about using [].some(check => !check). What do you think of the following code?

const checks = [    data.age > 18,    data.username.length > 6    ];if(data.isNewUser) {    checks.push(data.email !== undefined)} else {    checks.push(data.deleted === false)}const isValid = checks.some(check => !check);

[].some(true) ||?

: Commit (something I could commit)
: Vomit (I'd never commit this)
: I like your post please continue this series!

Let's vote!

Photo by Nik Shuliahin on Unsplash


Original Link: https://dev.to/jmdejager/commit-or-vomit-checks-some-46mh

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To