Preferences

jameshart parent
A little bit of truthiness seems like a good idea at first. You decide to treat empty strings and undefined as falsy and it feels good, so you go ahead and start treating zero as falsy too.

And then all of a sudden code that is expecting to get an array or undefined gets handed a zero or an empty string because someone called it with

   x && [x]
Or

   x.length && x
And that’s how you end up with a zero showing up on a webpage instead of a list of to-do items when the list is empty.

This item has no comments currently.