| In my experience of dealing with loosey goosey languages (JS, PHP, Perl), 80%+ of the errors you will receive are because of the type system. In PHP, if you look at your logs you'll see almost all the errors are checking an array with an index that doesn't exist. This is because people are using arrays as objects and then using strings as members. If you just use an object, this type of error is impossible. So, we have to write `??` everywhere because anything can always be null and then it can break stuff. And then you have errors with passing empty string vs null vs empty array to functions and getting unpredictable behavior. So you need to constantly check everything. If you actually open up a function in a dynamically typed language, take your pick, you'll see something like this: ```
if (arg === '' || arg === null || arg === undefined || arg === [])
...
``` If you don't include checks like that everywhere, your code will break. You just don't know it isn't broken yet. And, btw, something like PHP `empty()` is not a silver bullet either. Because it considers like a dozen different values to be empty. Which comes with it's own set of problems. |