console.assert liberally in my application. It throws an error if the first argument is falsey. E.g.:
console.assert(price > 0, 'Price isn\'t above 0')
It's easy to automatically remove this for production builds. When developing, I often accidentally break an assertion. I think this is better than unit tests, at least during the early stages of development, because:
development application state is more realistic than test states
assertions are easier to write, so developers will write more of them
Also, for a big enough application, I think it'll be good to keep the assertions in production for 1% of users. It's better to have it fail for 1% of users than to have silent errors for everyone.
However, I've never seen any tech companies do this. Why is that?