Oops, you’re right. Firefox, Edge, and Chrome do NOT support them.
Assuming that you’re using TDD, there’s little point in manually writing type guards like that.
Catching bugs is not what static types are good at. Use TDD for that.
For user inputs, use schema validations for security (needed with or without static types).
I think the confusion with
const is that we called it
const. A mathematical constant means a value that never changes, not a binding that doesn’t get reassigned within the same scope.
Examples in math include things like Pi, Phi, Euler’s constant, the number of seconds in a minute, etc… all values I would use…
const declarations are constant within a single function call, but variable in value between different calls. The analogy from algebra is this:
f(x) = 2x
This is the definition of the function,
f. In this context,
x is called a variable, even though its value does not change within any single…
Great post! Really, there’s no great way to hide your software implementation. Don’t bother trying. Game publishers used to run their code through obfuscators to try to combat pirating, but if it does anything remotely effective, it also hurts the performance of the app. Virtually all games would still be cracked the weekend they were released.