|
|
|
|
|
by sly010
3640 days ago
|
|
Sure, we can always make up an examples. Perhaps if you are using null to represent something explicitly in your data.
But silently failing on undefined is just going to lead to an other bug somewhere else entirely and half a day of debugging. I would much rather fail early and loudly than having to hunt down some
anecdotal bug that happens every prime-th national holiday and is impossible to reproduce. |
|
Having functions/methods return undefined is a huge time and complexity saver for UI code as the application could still be in the process of getting input from the user that then would be passed off to the back-end code once the user was done changing their minds. No point in having a dropdown throw an error because the user is still deciding what they want to appear in the dropdown.