|
|
|
|
|
by jeswin
1711 days ago
|
|
Here's another. Instead of returning Sometype|undefined from a function which may or may not have a value to return (such as searchCustomer), return Sometype|null. That forces the function to return a value that's explicitly intended rather than defaulting from a missed out if-else codepath. This is useful since JS is often imperative style code. |
|
I have only seen null vs undefined lead to 2 things in my experience: mistakes and bikeshedding.