βItβs only work if somebody makes you do it.β β’ craft code β’ creative ideas β’ cutting edge β’ author β’ senior front end architect β’ professional scuba diver β’ adventures above and below the sea level
Location
Germany
Work
Senior Front End Architect, Full Stack Engineer, Creative Technologist and Scuba Diving Professional
Interesting is that all these filtered can be coerced to false, and only the number 0 and
false
can, too. That would simplify the filter to:EDIT: The original article did something like:
Now that it is updated, the above doesn't seem to make sense, obviously.
Why not just this?
Because it was explicitly stated that
false
and0
should not be filtered. Your code would filter them.Ah, I misread - you want to keep
0
andfalse
. In which case, you can shorten to:The
!!
is unnecessary.Hi,
thank you for the simplification! I updated the article and the code.
Cheers!
Next time I suggest posting an edit rather than overwriting the old article. The comment above makes no sense given the new article context.