Thoughts

mental health break ,./'"**^^$_---
If I could change one thing about JS I would make it throw key-errors when doing lookups on objects instead of returning undefined.
People complain about the fact that all values in JS are null-able, but that doesn't bother me that much. It's not a strictly typed language, I want to be able to assign any data to any variable at any time. But it's really weird and not-obvious to me that `({}).key` should return `undefined`, I think it should error. This is what Python does, and if you want to optionally get an item from a dict, you can either check for presence beforehand, catch the KeyError, or use `.get("key", "default value")`. I think the three of those are more than flexible enough, and more explicit and readable. In my experience, I hit a lot of errors as a result of assuming a key exists, and it would be easier to locate and fix these errors if it failed-fast, and errored at the source, instead of propagating into an error later.
Link 1:52 p.m. Sep 26, 2022 UTC-4